| @@ 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 |
|
| @@ 295-313 (lines=19) @@ | ||
| 292 | * @param string $propertyPath |
|
| 293 | * @return array |
|
| 294 | */ |
|
| 295 | public function getAccessorsForPath($propertyPath) |
|
| 296 | { |
|
| 297 | $subject = $this->variables; |
|
| 298 | $accessors = []; |
|
| 299 | $propertyPathSegments = explode('.', $propertyPath); |
|
| 300 | foreach ($propertyPathSegments as $index => $pathSegment) { |
|
| 301 | $accessor = $this->detectAccessor($subject, $pathSegment); |
|
| 302 | if ($accessor === null) { |
|
| 303 | // Note: this may include cases of sub-variable references. When such |
|
| 304 | // a reference is encountered the accessor chain is stopped and new |
|
| 305 | // accessors will be detected for the sub-variable and all following |
|
| 306 | // path segments since the variable is now fully dynamic. |
|
| 307 | break; |
|
| 308 | } |
|
| 309 | $accessors[] = $accessor; |
|
| 310 | $subject = $this->extractSingleValue($subject, $pathSegment); |
|
| 311 | } |
|
| 312 | return $accessors; |
|
| 313 | } |
|
| 314 | ||
| 315 | /** |
|
| 316 | * @param string $propertyPath |
|