[ 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\Configuration; 8 use ProxyManager\Factory\RemoteObject\AdapterInterface; 9 use ProxyManager\Proxy\RemoteObjectInterface; 10 use ProxyManager\ProxyGenerator\ProxyGeneratorInterface; 11 use ProxyManager\ProxyGenerator\RemoteObjectGenerator; 12 use ProxyManager\Signature\Exception\InvalidSignatureException; 13 use ProxyManager\Signature\Exception\MissingSignatureException; 14 15 /** 16 * Factory responsible of producing remote proxy objects 17 * 18 * @author Vincent Blanchon <blanchon.vincent@gmail.com> 19 * @license MIT 20 */ 21 class RemoteObjectFactory extends AbstractBaseFactory 22 { 23 /** 24 * @var AdapterInterface 25 */ 26 protected $adapter; 27 28 /** 29 * @var \ProxyManager\ProxyGenerator\RemoteObjectGenerator|null 30 */ 31 private $generator; 32 33 /** 34 * {@inheritDoc} 35 * 36 * @param AdapterInterface $adapter 37 * @param Configuration $configuration 38 */ 39 public function __construct(AdapterInterface $adapter, Configuration $configuration = null) 40 { 41 parent::__construct($configuration); 42 43 $this->adapter = $adapter; 44 } 45 46 /** 47 * @param string|object $instanceOrClassName 48 * 49 * @throws InvalidSignatureException 50 * @throws MissingSignatureException 51 * @throws \OutOfBoundsException 52 */ 53 public function createProxy($instanceOrClassName) : RemoteObjectInterface 54 { 55 $proxyClassName = $this->generateProxy( 56 is_object($instanceOrClassName) ? get_class($instanceOrClassName) : $instanceOrClassName 57 ); 58 59 return $proxyClassName::staticProxyConstructor($this->adapter); 60 } 61 62 /** 63 * {@inheritDoc} 64 */ 65 protected function getGenerator() : ProxyGeneratorInterface 66 { 67 return $this->generator ?: $this->generator = new RemoteObjectGenerator(); 68 } 69 }
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 |