1 | <?php |
||
23 | class ClassFieldAccess extends AbstractJoinpoint implements FieldAccess |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * Instance of object for accessing |
||
28 | * |
||
29 | * @var object |
||
30 | */ |
||
31 | protected $instance; |
||
32 | |||
33 | /** |
||
34 | * Instance of reflection property |
||
35 | * |
||
36 | * @var ReflectionProperty |
||
37 | */ |
||
38 | protected $reflectionProperty; |
||
39 | |||
40 | /** |
||
41 | * New value to set |
||
42 | * |
||
43 | * @var mixed |
||
44 | */ |
||
45 | protected $newValue; |
||
46 | |||
47 | /** |
||
48 | * Access type for field access |
||
49 | * |
||
50 | * @var integer |
||
51 | */ |
||
52 | private $accessType; |
||
53 | |||
54 | /** |
||
55 | * Copy of the original value of property |
||
56 | * |
||
57 | * @var mixed |
||
58 | */ |
||
59 | private $value; |
||
60 | |||
61 | /** |
||
62 | * Constructor for field access |
||
63 | * |
||
64 | * @param array $advices List of advices for this invocation |
||
65 | */ |
||
66 | 4 | public function __construct(string $className, string $fieldName, array $advices) |
|
76 | |||
77 | /** |
||
78 | * Returns the access type. |
||
79 | */ |
||
80 | public function getAccessType(): int |
||
84 | |||
85 | /** |
||
86 | * Gets the field being accessed. |
||
87 | * |
||
88 | * @return AnnotatedReflectionProperty the property which is being accessed. |
||
89 | */ |
||
90 | 3 | public function getField(): ReflectionProperty |
|
94 | |||
95 | /** |
||
96 | * Gets the current value of property |
||
97 | */ |
||
98 | public function &getValue() |
||
104 | |||
105 | /** |
||
106 | * Gets the value that must be set to the field. |
||
107 | */ |
||
108 | public function &getValueToSet() |
||
114 | |||
115 | /** |
||
116 | * Checks scope rules for accessing property |
||
117 | */ |
||
118 | public function ensureScopeRule(int $stackLevel = 2): void |
||
140 | |||
141 | /** |
||
142 | * Proceed to the next interceptor in the Chain |
||
143 | * |
||
144 | * @return void For field interceptor there is no return values |
||
145 | */ |
||
146 | final public function proceed() |
||
154 | |||
155 | /** |
||
156 | * Invokes current field access with all interceptors |
||
157 | * |
||
158 | * @param object $instance Instance of object |
||
159 | * @param integer $accessType Type of access: READ or WRITE |
||
160 | * @param mixed $originalValue Original value of property |
||
161 | * @param mixed $newValue New value to set |
||
162 | * |
||
163 | * @return mixed |
||
164 | */ |
||
165 | final public function &__invoke(object $instance, int $accessType, &$originalValue, $newValue = NAN) |
||
197 | |||
198 | /** |
||
199 | * Returns the object for which current joinpoint is invoked |
||
200 | * |
||
201 | * @return object|null Instance of object or null for static call/unavailable context |
||
202 | */ |
||
203 | final public function getThis(): ?object |
||
207 | |||
208 | /** |
||
209 | * Checks if the current joinpoint is dynamic or static |
||
210 | * |
||
211 | * Dynamic joinpoint contains a reference to an object that can be received via getThis() method call |
||
212 | * |
||
213 | * @see ClassJoinpoint::getThis() |
||
214 | */ |
||
215 | 1 | final public function isDynamic(): bool |
|
219 | |||
220 | /** |
||
221 | * Returns the static scope name (class name) of this joinpoint. |
||
222 | */ |
||
223 | final public function getScope(): string |
||
228 | |||
229 | /** |
||
230 | * Returns a friendly description of current joinpoint |
||
231 | */ |
||
232 | final public function __toString(): string |
||
241 | } |
||
242 |