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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
MagicIsset.php
01 <?php
02
03 declare(strict_types=1);
04
05 namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator;
06
07 use ProxyManager\Generator\MagicMethodGenerator;
08 use Zend\Code\Generator\ParameterGenerator;
09 use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap;
10 use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator;
11 use ReflectionClass;
12 use Zend\Code\Generator\PropertyGenerator;
13
14 /**
15 * Magic `__isset` method for lazy loading value holder objects
16 *
17 * @author Marco Pivetta <ocramius@gmail.com>
18 * @license MIT
19 */
20 class MagicIsset extends MagicMethodGenerator
21 {
22 /**
23 * Constructor
24 *
25 * @param ReflectionClass $originalClass
26 * @param PropertyGenerator $initializerProperty
27 * @param PropertyGenerator $valueHolderProperty
28 * @param PublicPropertiesMap $publicProperties
29 *
30 * @throws \Zend\Code\Generator\Exception\InvalidArgumentException
31 * @throws \InvalidArgumentException
32 */
33 public function __construct(
34 ReflectionClass $originalClass,
35 PropertyGenerator $initializerProperty,
36 PropertyGenerator $valueHolderProperty,
37 PublicPropertiesMap $publicProperties
38 ) {
39 parent::__construct($originalClass, '__isset', [new ParameterGenerator('name')]);
40
41 $initializer = $initializerProperty->getName();
42 $valueHolder = $valueHolderProperty->getName();
43 $callParent = '';
44
45 if (! $publicProperties->isEmpty()) {
46 $callParent = 'if (isset(self::$' . $publicProperties->getName() . "[\$name])) {\n"
47 . ' return isset($this->' . $valueHolder . '->$name);'
48 . "\n}\n\n";
49 }
50
51 $callParent .= PublicScopeSimulator::getPublicAccessSimulationCode(
52 PublicScopeSimulator::OPERATION_ISSET,
53 'name',
54 null,
55 $valueHolderProperty
56 );
57
58 $this->setBody(
59 '$this->' . $initializer . ' && $this->' . $initializer
60 . '->__invoke($this->' . $valueHolder . ', $this, \'__isset\', array(\'name\' => $name), $this->'
61 . $initializer . ');' . "\n\n" . $callParent
62 );
63 }
64 }
65