| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php namespace Tarsana\Command\Helpers; |
||
| 25 | public function asString(Syntax $syntax) : string |
||
| 26 | { |
||
| 27 | $type = $this->type($syntax); |
||
| 28 | if ($type == 'optional') |
||
| 29 | return $this->asString($syntax->syntax()); |
||
|
|
|||
| 30 | switch ($type) { |
||
| 31 | case 'object': |
||
| 32 | return implode( |
||
| 33 | $syntax->separator(), |
||
| 34 | array_keys($syntax->fields()) |
||
| 35 | ); |
||
| 36 | break; |
||
| 37 | case 'array': |
||
| 38 | $text = $this->asString($syntax->syntax()); |
||
| 39 | return "{$text}{$syntax->separator()}..."; |
||
| 40 | break; |
||
| 41 | default: |
||
| 42 | return $type; |
||
| 43 | } |
||
| 60 |