| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 18 | 8 | public function call(?BaseToken ...$parameters): BaseToken |
|
| 19 | { |
||
| 20 | 8 | if (!$this->token instanceof TokenString) { |
|
|
|
|||
| 21 | 2 | throw new ParserException('Call to undefined method "endsWith" on non-string'); |
|
| 22 | } |
||
| 23 | |||
| 24 | 6 | $needle = $this->parseParameter($parameters, numParam: 0); |
|
| 25 | 6 | $haystack = $this->token->getValue(); |
|
| 26 | |||
| 27 | 6 | if (!$needle) { |
|
| 28 | 2 | $result = false; |
|
| 29 | } else { |
||
| 30 | 4 | $needle = $needle->getValue(); |
|
| 31 | 4 | $result = str_ends_with($haystack, $needle); |
|
| 32 | } |
||
| 33 | |||
| 34 | 6 | return TokenBool::fromBool($result); |
|
| 35 | } |
||
| 37 |