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\AccessInterceptorValueHolder\MethodGenerator;
06
07 use ProxyManager\Generator\MagicMethodGenerator;
08 use ProxyManager\ProxyGenerator\Util\GetMethodIfExists;
09 use Zend\Code\Generator\ParameterGenerator;
10 use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\Util\InterceptorGenerator;
11 use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap;
12 use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator;
13 use ReflectionClass;
14 use Zend\Code\Generator\PropertyGenerator;
15
16 /**
17 * Magic `__isset` for method interceptor value holder objects
18 *
19 * @author Marco Pivetta <ocramius@gmail.com>
20 * @license MIT
21 */
22 class MagicIsset extends MagicMethodGenerator
23 {
24 /**
25 * Constructor
26 * @param ReflectionClass $originalClass
27 * @param PropertyGenerator $valueHolder
28 * @param PropertyGenerator $prefixInterceptors
29 * @param PropertyGenerator $suffixInterceptors
30 * @param PublicPropertiesMap $publicProperties
31 *
32 * @throws \Zend\Code\Generator\Exception\InvalidArgumentException
33 * @throws \InvalidArgumentException
34 */
35 public function __construct(
36 ReflectionClass $originalClass,
37 PropertyGenerator $valueHolder,
38 PropertyGenerator $prefixInterceptors,
39 PropertyGenerator $suffixInterceptors,
40 PublicPropertiesMap $publicProperties
41 ) {
42 parent::__construct($originalClass, '__isset', [new ParameterGenerator('name')]);
43
44 $parent = GetMethodIfExists::get($originalClass, '__isset');
45 $valueHolderName = $valueHolder->getName();
46
47 $callParent = PublicScopeSimulator::getPublicAccessSimulationCode(
48 PublicScopeSimulator::OPERATION_ISSET,
49 'name',
50 'value',
51 $valueHolder,
52 'returnValue'
53 );
54
55 if (! $publicProperties->isEmpty()) {
56 $callParent = 'if (isset(self::$' . $publicProperties->getName() . "[\$name])) {\n"
57 . ' $returnValue = isset($this->' . $valueHolderName . '->$name);'
58 . "\n} else {\n $callParent\n}\n\n";
59 }
60
61 $this->setBody(InterceptorGenerator::createInterceptedMethodBody(
62 $callParent,
63 $this,
64 $valueHolder,
65 $prefixInterceptors,
66 $suffixInterceptors,
67 $parent
68 ));
69 }
70 }
71