| 1 | <?php |
||
| 19 | */ |
||
| 20 | class NullObjectFactory extends AbstractBaseFactory |
||
| 21 | { |
||
| 22 | private NullObjectGenerator $generator; |
||
|
|
|||
| 23 | |||
| 24 | public function __construct(?Configuration $configuration = null) |
||
| 25 | { |
||
| 26 | parent::__construct($configuration); |
||
| 27 | |||
| 28 | $this->generator = new NullObjectGenerator(); |
||
| 29 | } |
||
| 30 | |||
| 31 | 2 | /** |
|
| 32 | * @param object|string $instanceOrClassName the object to be wrapped or interface to transform to null object |
||
| 33 | 2 | * |
|
| 34 | 2 | * @throws InvalidSignatureException |
|
| 35 | * @throws MissingSignatureException |
||
| 36 | 2 | * @throws OutOfBoundsException |
|
| 37 | */ |
||
| 38 | public function createProxy($instanceOrClassName) : NullObjectInterface |
||
| 39 | { |
||
| 40 | $className = is_object($instanceOrClassName) ? get_class($instanceOrClassName) : $instanceOrClassName; |
||
| 41 | $proxyClassName = $this->generateProxy($className); |
||
| 42 | 1 | ||
| 43 | return $proxyClassName::staticProxyConstructor(); |
||
| 44 | 1 | } |
|
| 45 | |||
| 46 | /** |
||
| 47 | * {@inheritDoc} |
||
| 54 |