@@ 96-113 (lines=18) @@ | ||
93 | * @param string $propertyPath |
|
94 | * @return array |
|
95 | */ |
|
96 | public function getAccessorsForPath($subject, $propertyPath) |
|
97 | { |
|
98 | $accessors = []; |
|
99 | $propertyPathSegments = explode('.', $propertyPath); |
|
100 | foreach ($propertyPathSegments as $index => $pathSegment) { |
|
101 | $accessor = $this->detectAccessor($subject, $pathSegment); |
|
102 | if ($accessor === null) { |
|
103 | // Note: this may include cases of sub-variable references. When such |
|
104 | // a reference is encountered the accessor chain is stopped and new |
|
105 | // accessors will be detected for the sub-variable and all following |
|
106 | // path segments since the variable is now fully dynamic. |
|
107 | break; |
|
108 | } |
|
109 | $accessors[] = $accessor; |
|
110 | $subject = $this->extractSingleValue($subject, $pathSegment); |
|
111 | } |
|
112 | return $accessors; |
|
113 | } |
|
114 | ||
115 | /** |
|
116 | * @param mixed $subject |
@@ 239-257 (lines=19) @@ | ||
236 | * @param string $propertyPath |
|
237 | * @return array |
|
238 | */ |
|
239 | public function getAccessorsForPath($propertyPath) |
|
240 | { |
|
241 | $subject = $this->variables; |
|
242 | $accessors = []; |
|
243 | $propertyPathSegments = explode('.', $propertyPath); |
|
244 | foreach ($propertyPathSegments as $index => $pathSegment) { |
|
245 | $accessor = $this->detectAccessor($subject, $pathSegment); |
|
246 | if ($accessor === null) { |
|
247 | // Note: this may include cases of sub-variable references. When such |
|
248 | // a reference is encountered the accessor chain is stopped and new |
|
249 | // accessors will be detected for the sub-variable and all following |
|
250 | // path segments since the variable is now fully dynamic. |
|
251 | break; |
|
252 | } |
|
253 | $accessors[] = $accessor; |
|
254 | $subject = $this->extractSingleValue($subject, $pathSegment); |
|
255 | } |
|
256 | return $accessors; |
|
257 | } |
|
258 | ||
259 | /** |
|
260 | * @param string $propertyPath |