Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
9 | 33 | public function extract($pathExpression) |
|
10 | { |
||
11 | 33 | $tokensRepresentation = preg_split(self::TOKEN_DELIMITER_REGEX, $pathExpression, -1, PREG_SPLIT_NO_EMPTY); |
|
12 | 33 | $tokens = []; |
|
13 | 33 | foreach ($tokensRepresentation as $tokenRepresentation) { |
|
14 | 33 | if (preg_match('/(\d+)\]/', $tokenRepresentation, $matches)) { |
|
15 | 7 | $arrayKey = intval($matches[1]); |
|
16 | 7 | $tokens[] = new ArrayAccessToken($arrayKey); |
|
17 | } else { |
||
18 | 33 | $tokens[] = new ObjectAccessToken($tokenRepresentation); |
|
19 | } |
||
20 | } |
||
21 | 33 | return $tokens; |
|
22 | } |
||
23 | } |
||
24 |