| Conditions | 4 |
| Paths | 5 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 50 | 22 | protected function buildArguments(array $arguments, array $defaults = []) : string |
|
| 51 | { |
||
| 52 | 22 | $argumentsString = []; |
|
| 53 | 22 | $defaults = array_filter($defaults); |
|
| 54 | 22 | foreach ($arguments as $argumentName => $argumentType) { |
|
| 55 | // Group name with type |
||
| 56 | 11 | $argumentsString[] = ($argumentType !== null ? $argumentType . ' ' : '') . |
|
| 57 | 11 | '$' . $argumentName . |
|
| 58 | 11 | (array_key_exists($argumentName, $defaults) ? ' = ' . $defaults[$argumentName] : ''); |
|
| 59 | } |
||
| 60 | |||
| 61 | 22 | return implode(', ', $argumentsString); |
|
| 62 | } |
||
| 63 | } |
||
| 64 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: