Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
19 | 6 | public function call(?BaseToken ...$parameters): BaseToken |
|
20 | { |
||
21 | 6 | if (!$this->token instanceof TokenString) { |
|
22 | 2 | throw new ParserException('Call to undefined method "startsWith" on non-string'); |
|
23 | } |
||
24 | |||
25 | 4 | $needle = $this->parseParameter($parameters, 0); |
|
26 | 4 | $offset = $this->getOffset($this->parseParameter($parameters, 1)); |
|
27 | 4 | $position = strpos($this->token->getValue(), $needle->getValue(), $offset); |
|
28 | |||
29 | 4 | return new TokenBool($position === $offset); |
|
30 | } |
||
43 |