[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 declare(strict_types=1); 4 5 namespace ProxyManager\Factory; 6 7 use ProxyManager\Proxy\NullObjectInterface; 8 use ProxyManager\ProxyGenerator\NullObjectGenerator; 9 use ProxyManager\ProxyGenerator\ProxyGeneratorInterface; 10 use ProxyManager\Signature\Exception\InvalidSignatureException; 11 use ProxyManager\Signature\Exception\MissingSignatureException; 12 13 /** 14 * Factory responsible of producing proxy objects 15 * 16 * @author Vincent Blanchon <blanchon.vincent@gmail.com> 17 * @license MIT 18 */ 19 class NullObjectFactory extends AbstractBaseFactory 20 { 21 /** 22 * @var \ProxyManager\ProxyGenerator\NullObjectGenerator|null 23 */ 24 private $generator; 25 26 /** 27 * @param object|string $instanceOrClassName the object to be wrapped or interface to transform to null object 28 * 29 * @throws InvalidSignatureException 30 * @throws MissingSignatureException 31 * @throws \OutOfBoundsException 32 */ 33 public function createProxy($instanceOrClassName) : NullObjectInterface 34 { 35 $className = is_object($instanceOrClassName) ? get_class($instanceOrClassName) : $instanceOrClassName; 36 $proxyClassName = $this->generateProxy($className); 37 38 return $proxyClassName::staticProxyConstructor(); 39 } 40 41 /** 42 * {@inheritDoc} 43 */ 44 protected function getGenerator() : ProxyGeneratorInterface 45 { 46 return $this->generator ?: $this->generator = new NullObjectGenerator(); 47 } 48 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |