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 |
StaticProxyConstructor.php
01 <?php
02
03 declare(strict_types=1);
04
05 namespace ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator;
06
07 use ProxyManager\Generator\MethodGenerator;
08 use Zend\Code\Generator\ParameterGenerator;
09 use ReflectionClass;
10
11 /**
12 * The `staticProxyConstructor` implementation for an access interceptor scope localizer proxy
13 *
14 * @author Marco Pivetta <ocramius@gmail.com>
15 * @license MIT
16 */
17 class StaticProxyConstructor extends MethodGenerator
18 {
19 /**
20 * Constructor
21 *
22 * @param ReflectionClass $originalClass
23 *
24 * @throws \Zend\Code\Generator\Exception\InvalidArgumentException
25 */
26 public function __construct(ReflectionClass $originalClass)
27 {
28 parent::__construct('staticProxyConstructor', [], static::FLAG_PUBLIC | static::FLAG_STATIC);
29
30 $localizedObject = new ParameterGenerator('localizedObject');
31 $prefix = new ParameterGenerator('prefixInterceptors');
32 $suffix = new ParameterGenerator('suffixInterceptors');
33
34 $localizedObject->setType($originalClass->getName());
35 $prefix->setDefaultValue([]);
36 $suffix->setDefaultValue([]);
37 $prefix->setType('array');
38 $suffix->setType('array');
39
40 $this->setParameter($localizedObject);
41 $this->setParameter($prefix);
42 $this->setParameter($suffix);
43 $this->setReturnType($originalClass->getName());
44
45 $this->setDocBlock(
46 "Constructor to setup interceptors\n\n"
47 . "@param \\" . $originalClass->getName() . " \$localizedObject\n"
48 . "@param \\Closure[] \$prefixInterceptors method interceptors to be used before method logic\n"
49 . "@param \\Closure[] \$suffixInterceptors method interceptors to be used before method logic\n\n"
50 . '@return self'
51 );
52 $this->setBody(
53 'static $reflection;' . "\n\n"
54 . '$reflection = $reflection ?: $reflection = new \ReflectionClass(__CLASS__);' . "\n"
55 . '$instance = $reflection->newInstanceWithoutConstructor();' . "\n\n"
56 . '$instance->bindProxyProperties($localizedObject, $prefixInterceptors, $suffixInterceptors);' . "\n\n"
57 . 'return $instance;'
58 );
59 }
60 }
61