| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.128 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | 10 | public static function parseParams(array $params, $args) |
|
| 39 | { |
||
| 40 | 10 | $ordered_args = array(); |
|
| 41 | |||
| 42 | 10 | foreach ($params as $param) { |
|
| 43 | 10 | if (! $param instanceof ReflectionParameter) { |
|
| 44 | throw new RuntimeException( |
||
| 45 | sprintf( |
||
| 46 | _('Parameter %1$s is not an instance of ReflectionParameter.'), |
||
| 47 | $param |
||
| 48 | ) |
||
| 49 | ); |
||
| 50 | } |
||
| 51 | 10 | $ordered_args[] = array_key_exists($param->name, $args) |
|
| 52 | 8 | ? $args[$param->name] |
|
| 53 | 10 | : $param->getDefaultValue(); |
|
| 54 | } |
||
| 55 | |||
| 56 | 8 | return $ordered_args; |
|
| 57 | } |
||
| 58 | } |
||
| 59 |