| Conditions | 4 |
| Paths | 6 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 10 | public function call($offset = null): BaseToken |
|
| 24 | { |
||
| 25 | 10 | $tokenValue = $this->token->getValue(); |
|
| 26 | |||
| 27 | 10 | if (!$offset) { |
|
| 28 | 2 | $offset = 0; |
|
| 29 | } |
||
| 30 | 8 | elseif (!$offset instanceof TokenInteger) { |
|
| 31 | 2 | $offset = (int) $offset->getValue(); |
|
| 32 | } else { |
||
| 33 | 6 | $offset = $offset->getValue(); |
|
| 34 | } |
||
| 35 | |||
| 36 | 10 | if (!isset($tokenValue[$offset])) { |
|
| 37 | 2 | $char = ''; |
|
| 38 | } else { |
||
| 39 | 8 | $char = $tokenValue[$offset]; |
|
| 40 | } |
||
| 41 | |||
| 42 | 10 | return new TokenString( |
|
| 43 | 10 | $char, |
|
| 44 | 10 | $this->token->getOffset(), |
|
| 45 | 10 | $this->token->getStack() |
|
| 46 | ); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |