[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 require_once __DIR__ . '/../vendor/autoload.php'; 4 5 use ProxyManager\Factory\LazyLoadingGhostFactory; 6 7 class Foo 8 { 9 private $foo; 10 11 public function __construct() 12 { 13 sleep(5); 14 } 15 16 public function setFoo($foo) 17 { 18 $this->foo = (string) $foo; 19 } 20 21 public function getFoo() 22 { 23 return $this->foo; 24 } 25 } 26 27 $startTime = microtime(true); 28 $factory = new LazyLoadingGhostFactory(); 29 30 for ($i = 0; $i < 1000; $i += 1) { 31 $proxy = $factory->createProxy( 32 'Foo', 33 function ($proxy, $method, $parameters, & $initializer) { 34 $initializer = null; 35 $proxy->setFoo('Hello World!'); 36 37 return true; 38 } 39 ); 40 } 41 42 var_dump('time after 1000 instantiations: ' . (microtime(true) - $startTime)); 43 44 echo $proxy->getFoo() . "\n"; 45 46 var_dump('time after single call to doFoo: ' . (microtime(true) - $startTime));
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |