| Conditions | 4 |
| Paths | 6 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 17 | 10 | public function call(?BaseToken ...$parameters): BaseToken |
|
| 18 | { |
||
| 19 | 10 | $tokenValue = $this->token->getValue(); |
|
|
|
|||
| 20 | 10 | $offset = $this->parseParameter($parameters, numParam: 0); |
|
| 21 | |||
| 22 | 10 | if (!$offset) { |
|
| 23 | 2 | $offset = 0; |
|
| 24 | 8 | } elseif (!$offset instanceof TokenInteger) { |
|
| 25 | 2 | $offset = (int) $offset->getValue(); |
|
| 26 | } else { |
||
| 27 | 6 | $offset = $offset->getValue(); |
|
| 28 | } |
||
| 29 | |||
| 30 | 10 | if (!isset($tokenValue[$offset])) { |
|
| 31 | 2 | $char = ''; |
|
| 32 | } else { |
||
| 33 | 8 | $char = $tokenValue[$offset]; |
|
| 34 | } |
||
| 35 | |||
| 36 | 10 | return new TokenString($char); |
|
| 37 | } |
||
| 39 |