1 | <?php |
||
35 | class MethodInvocation implements MethodInvocationInterface |
||
36 | { |
||
37 | |||
38 | /** |
||
39 | * Array containing callbacks which allow to call the contained piece of code. |
||
40 | * Allows for a chain of callbacks e.g. with advice chaining |
||
41 | * |
||
42 | * @var array<callable> $callbackChain |
||
43 | */ |
||
44 | protected $callbackChain; |
||
45 | |||
46 | /** |
||
47 | * The context in which the invocation happens, is the same as accessing $this within the method logic |
||
48 | * |
||
49 | * @var object $context |
||
50 | */ |
||
51 | protected $context; |
||
52 | |||
53 | /** |
||
54 | * Is the function abstract? |
||
55 | * |
||
56 | * @var boolean $isAbstract |
||
57 | */ |
||
58 | protected $isAbstract; |
||
59 | |||
60 | /** |
||
61 | * Is the function final? |
||
62 | * |
||
63 | * @var boolean $isFinal |
||
64 | */ |
||
65 | protected $isFinal; |
||
66 | |||
67 | /** |
||
68 | * Is the method static? |
||
69 | * |
||
70 | * @var boolean $isStatic |
||
71 | */ |
||
72 | protected $isStatic; |
||
73 | |||
74 | /** |
||
75 | * The name of the function |
||
76 | * |
||
77 | * @var string $name |
||
78 | */ |
||
79 | protected $name; |
||
80 | |||
81 | /** |
||
82 | * Array of parameters of the form <PARAMETER_NAME> => <PARAMETER_VALUE> |
||
83 | * |
||
84 | * @var array $parameters |
||
85 | */ |
||
86 | protected $parameters; |
||
87 | |||
88 | /** |
||
89 | * The result of the method invocation |
||
90 | * |
||
91 | * @var mixed $result |
||
92 | */ |
||
93 | protected $result; |
||
94 | |||
95 | /** |
||
96 | * Name of the structure (class/trait/...) which contains the method |
||
97 | * |
||
98 | * @var string $structureName |
||
99 | */ |
||
100 | protected $structureName; |
||
101 | |||
102 | /** |
||
103 | * The exception thrown by the method invocation |
||
104 | * |
||
105 | * @var \Exception $thrownException |
||
106 | */ |
||
107 | protected $thrownException; |
||
108 | |||
109 | /** |
||
110 | * Visibility of the method |
||
111 | * |
||
112 | * @var string $visibility |
||
113 | */ |
||
114 | protected $visibility; |
||
115 | |||
116 | /** |
||
117 | * Default constructor |
||
118 | * |
||
119 | * @param array<callable> $callbackChain Callback which allows to call the initially invoked |
||
120 | * @param object $context The context in which the invocation happens e.g. $this |
||
121 | * @param boolean $isAbstract Is the function abstract? |
||
122 | * @param boolean $isFinal Is the function final? |
||
123 | * @param boolean $isStatic Is the method static? |
||
124 | * @param string $name The name of the function |
||
125 | * @param array $parameters Array of parameters of the form <PARAMETER_NAME> => <PARAMETER_VALUE> |
||
126 | * @param string $structureName Name of the structure (class/trait/...) which contains the method |
||
127 | * @param string $visibility Visibility of the method |
||
128 | */ |
||
129 | public function __construct( |
||
150 | |||
151 | /** |
||
152 | * Getter method for property $context |
||
153 | * |
||
154 | * @return object |
||
155 | */ |
||
156 | public function getContext() |
||
160 | |||
161 | /** |
||
162 | * Getter method for property $name |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | public function getName() |
||
170 | |||
171 | /** |
||
172 | * Getter for the result of the method invocation |
||
173 | * |
||
174 | * @return mixed |
||
175 | */ |
||
176 | public function getResult() |
||
180 | |||
181 | /** |
||
182 | * Getter method for property $parameters |
||
183 | * |
||
184 | * @return array |
||
185 | */ |
||
186 | public function getParameters() |
||
190 | |||
191 | /** |
||
192 | * Getter method for property $structureName |
||
193 | * |
||
194 | * @return string |
||
195 | */ |
||
196 | public function getStructureName() |
||
200 | |||
201 | /** |
||
202 | * Getter method for property $thrownException |
||
203 | * |
||
204 | * @return string |
||
205 | */ |
||
206 | public function getThrownException() |
||
210 | |||
211 | /** |
||
212 | * Getter method for property $visibility |
||
213 | * |
||
214 | * @return string |
||
215 | */ |
||
216 | public function getVisibility() |
||
220 | |||
221 | /** |
||
222 | * Will be used to inject the result of the original method |
||
223 | * |
||
224 | * @param mixed $result The result to inject |
||
225 | * |
||
226 | * @return mixed |
||
227 | */ |
||
228 | public function injectResult($result) |
||
232 | |||
233 | /** |
||
234 | * Used to injection the thrown exception, if any |
||
235 | * |
||
236 | * @param \Exception $thrownException The exception instance to inject |
||
237 | * |
||
238 | * @return null |
||
239 | */ |
||
240 | public function injectThrownException(\Exception $thrownException) |
||
244 | |||
245 | /** |
||
246 | * Getter method for property $isAbstract |
||
247 | * |
||
248 | * @return boolean |
||
249 | */ |
||
250 | public function isAbstract() |
||
254 | |||
255 | /** |
||
256 | * Getter method for property $isFinal |
||
257 | * |
||
258 | * @return boolean |
||
259 | */ |
||
260 | public function isFinal() |
||
264 | |||
265 | /** |
||
266 | * Getter method for property $isStatic |
||
267 | * |
||
268 | * @return boolean |
||
269 | */ |
||
270 | public function isStatic() |
||
274 | |||
275 | /** |
||
276 | * Will begin the execution of the initially invoked method. |
||
277 | * Acts as a wrapper around the initial method logic and will return the same result and throw the same exceptions, |
||
278 | * so use it instead of the original call |
||
279 | * |
||
280 | * @return mixed |
||
281 | * |
||
282 | * @throws \Exception |
||
283 | */ |
||
284 | public function proceed() |
||
319 | |||
320 | /** |
||
321 | * Setter method for property $parameters |
||
322 | * |
||
323 | * @param array $parameters New parameters to set |
||
324 | * |
||
325 | * @return null |
||
326 | */ |
||
327 | public function setParameters(array $parameters) |
||
331 | } |
||
332 |