| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | 8 | public function createReference(string $text): ReferenceInterface |
|
| 14 | { |
||
| 15 | 8 | if ('-' == $text) { |
|
| 16 | 1 | return new NextIndexReference(); |
|
| 17 | } |
||
| 18 | |||
| 19 | 7 | $isIndex = 1 === preg_match('/^(?:0|[1-9][0-9]*)$/', $text); |
|
| 20 | |||
| 21 | 7 | return $isIndex |
|
| 22 | 3 | ? new IndexReference(intval($text)) |
|
| 23 | 7 | : new PropertyReference($text); |
|
| 24 | } |
||
| 26 |