| Conditions | 6 |
| Paths | 8 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | 6 | public function generate(Argument $argument): string |
|
| 40 | { |
||
| 41 | 6 | $output = $this->typeGenerator->generate($argument->type()) . ' '; |
|
| 42 | |||
| 43 | 6 | if ($argument->isReference() && $argument->type()->isScalar()) { |
|
| 44 | 1 | $output .= ' &'; |
|
| 45 | } |
||
| 46 | |||
| 47 | 6 | if ($argument->isVariadic()) { |
|
| 48 | 1 | $output .= ' ...'; |
|
| 49 | } |
||
| 50 | |||
| 51 | 6 | $output .= '$' . $argument->name(); |
|
| 52 | |||
| 53 | 6 | if ($argument->defaultValue()->value() === null && !$argument->type()->isNullable()) { |
|
| 54 | 4 | return trim(preg_replace('/\s+/', ' ', $output)); |
|
| 55 | } |
||
| 56 | |||
| 57 | 2 | $output .= ' = ' . $this->valueGenerator->generate($argument->defaultValue()); |
|
| 58 | |||
| 59 | 2 | return trim(preg_replace('/\s+/', ' ', $output)); |
|
| 60 | } |
||
| 61 | } |
||
| 62 |