1 | <?php |
||
25 | class ConstructorExecutionTransformer implements SourceTransformer |
||
26 | { |
||
27 | /** |
||
28 | * List of constructor invocations per class |
||
29 | * |
||
30 | * @var array|ReflectionConstructorInvocation[] |
||
31 | */ |
||
32 | private static $constructorInvocationsCache = []; |
||
33 | |||
34 | /** |
||
35 | * Singletone |
||
36 | * |
||
37 | * @return static |
||
38 | */ |
||
39 | public static function getInstance() |
||
48 | |||
49 | /** |
||
50 | * Rewrites all "new" expressions with our implementation |
||
51 | * |
||
52 | * @param StreamMetaData $metadata Metadata for source |
||
53 | * |
||
54 | * @return string See RESULT_XXX constants in the interface |
||
55 | */ |
||
56 | 13 | public function transform(StreamMetaData $metadata): string |
|
87 | |||
88 | /** |
||
89 | * Magic interceptor for instance creation |
||
90 | * |
||
91 | * @param string $className Name of the class to construct |
||
92 | * |
||
93 | * @return object Instance of required object |
||
94 | */ |
||
95 | public function __get($className) |
||
99 | |||
100 | /** |
||
101 | * Magic interceptor for instance creation |
||
102 | * |
||
103 | * @param string $className Name of the class to construct |
||
104 | * @param array $args Arguments for the constructor |
||
105 | * |
||
106 | * @return object Instance of required object |
||
107 | */ |
||
108 | public function __call($className, array $args) |
||
112 | |||
113 | /** |
||
114 | * Default implementation for accessing joinpoint or creating a new one on-fly |
||
115 | * |
||
116 | * @param string $fullClassName Name of the class to create |
||
117 | * @param array $arguments Arguments for constructor |
||
118 | * |
||
119 | * @return object |
||
120 | */ |
||
121 | protected static function construct(string $fullClassName, array $arguments = []) |
||
145 | } |
||
146 |