1 | <?php |
||
19 | abstract class AbstractProxy |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * Indent for source code |
||
24 | * |
||
25 | * @var int |
||
26 | */ |
||
27 | protected $indent = 4; |
||
28 | |||
29 | /** |
||
30 | * List of advices that are used for generation of child |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $advices = []; |
||
35 | |||
36 | /** |
||
37 | * PHP expression string for accessing LSB information |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected static $staticLsbExpression = 'static::class'; |
||
42 | |||
43 | /** |
||
44 | * Constructs an abstract proxy class |
||
45 | * |
||
46 | * @param array $advices List of advices |
||
47 | */ |
||
48 | 6 | public function __construct(array $advices = []) |
|
52 | |||
53 | /** |
||
54 | * Returns text representation of class |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | abstract public function __toString(); |
||
59 | |||
60 | /** |
||
61 | * Indent block of code |
||
62 | * |
||
63 | * @param string $text Non-indented text |
||
64 | * |
||
65 | * @return string Indented text |
||
66 | */ |
||
67 | 6 | protected function indent($text) |
|
76 | |||
77 | /** |
||
78 | * Returns list of string representation of parameters |
||
79 | * |
||
80 | * @param array|ReflectionParameter[] $parameters List of parameters |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | 6 | protected function getParameters(array $parameters) |
|
93 | |||
94 | /** |
||
95 | * Return string representation of parameter |
||
96 | * |
||
97 | * @param ReflectionParameter $parameter Reflection parameter |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | 3 | protected function getParameterCode(ReflectionParameter $parameter) |
|
137 | |||
138 | /** |
||
139 | * Replace concrete advices with list of ids |
||
140 | * |
||
141 | * @param $advices |
||
142 | * |
||
143 | * @return array flatten list of advices |
||
144 | */ |
||
145 | 6 | private function flattenAdvices($advices) |
|
158 | |||
159 | /** |
||
160 | * Prepares a line with args from the method definition |
||
161 | * |
||
162 | * @param ReflectionFunctionAbstract $functionLike |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | 6 | protected function prepareArgsLine(ReflectionFunctionAbstract $functionLike) |
|
194 | } |
||
195 |