Conditions | 4 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
19 | 18 | public function call(?BaseToken ...$parameters): BaseToken |
|
20 | { |
||
21 | 18 | if (!$this->token instanceof TokenArray) { |
|
|
|||
22 | 2 | throw new ParserException(sprintf('%s.join is not a function', $this->token->getValue())); |
|
23 | } |
||
24 | |||
25 | 16 | $glue = $this->parseParameter($parameters, numParam: 0); |
|
26 | |||
27 | 16 | if ($glue) { |
|
28 | 14 | $glue = $glue->getValue(); |
|
29 | } else { |
||
30 | 2 | $glue = ','; |
|
31 | } |
||
32 | |||
33 | 16 | $array = $this->token->getValue(); |
|
34 | |||
35 | 16 | if ($array instanceof TokenCollection) { |
|
36 | 14 | $array = $array->toArray(); |
|
37 | } |
||
38 | |||
39 | 16 | return new TokenString(implode($glue, $array)); |
|
40 | } |
||
42 |