Code Duplication    Length = 18-19 lines in 2 locations

src/Core/Variables/StandardVariableProvider.php 1 location

@@ 231-249 (lines=19) @@
228
     * @param string $propertyPath
229
     * @return array
230
     */
231
    public function getAccessorsForPath($propertyPath)
232
    {
233
        $subject = $this->variables;
234
        $accessors = [];
235
        $propertyPathSegments = explode('.', $propertyPath);
236
        foreach ($propertyPathSegments as $index => $pathSegment) {
237
            $accessor = $this->detectAccessor($subject, $pathSegment);
238
            if ($accessor === null) {
239
                // Note: this may include cases of sub-variable references. When such
240
                // a reference is encountered the accessor chain is stopped and new
241
                // accessors will be detected for the sub-variable and all following
242
                // path segments since the variable is now fully dynamic.
243
                break;
244
            }
245
            $accessors[] = $accessor;
246
            $subject = $this->extractSingleValue($subject, $pathSegment);
247
        }
248
        return $accessors;
249
    }
250
251
    /**
252
     * @param string $propertyPath

src/Core/Variables/VariableExtractor.php 1 location

@@ 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