Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
22 | 1 | protected function doResolve($context = null): string |
|
23 | { |
||
24 | 1 | $string = (string)$this->string->resolve($context); |
|
25 | 1 | $lengthOrOffset = (int)$this->offset->resolve($context); |
|
26 | 1 | if ($this->length === null) { |
|
27 | 1 | $offset = 0; |
|
28 | 1 | $length = $lengthOrOffset; |
|
29 | } else { |
||
30 | 1 | $offset = $lengthOrOffset; |
|
31 | 1 | $length = (int)$this->length->resolve($context); |
|
32 | } |
||
33 | |||
34 | 1 | return substr($string, $offset, $length); |
|
35 | } |
||
37 |