Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

NullObjectFactory.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 1.39 KiB


01  <?php
02   
03  declare(strict_types=1);
04   
05  namespace ProxyManager\Factory;
06   
07  use ProxyManager\Proxy\NullObjectInterface;
08  use ProxyManager\ProxyGenerator\NullObjectGenerator;
09  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  }
49