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