Conditions | 3 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
16 | 4 | public function run(array $args) |
|
17 | { |
||
18 | 4 | $this->expectArguments('sub-string', [['String'], ['Number']], $args); |
|
19 | 4 | $string = $args[0]->value(); |
|
20 | 4 | $start = $args[1]->value(); |
|
21 | |||
22 | 4 | if (isset($args[2]) && $this->isDesmondType('Number', $args[2])) { |
|
23 | 1 | $length = $args[2]->value(); |
|
24 | 1 | $string = substr($string, $start, $length); |
|
25 | } else { |
||
26 | 3 | $string = substr($string, $start); |
|
27 | } |
||
28 | |||
29 | 4 | return $this->newReturnType('String', $string); |
|
30 | } |
||
31 | } |
||
32 |