| Conditions | 2 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 105 | public static function fromArray(array $configValues) |
|
| 18 | { |
||
| 19 | 105 | $config = static::of(); |
|
| 20 | 105 | array_walk( |
|
| 21 | 105 | $configValues, |
|
| 22 | 105 | function ($value, $key) use ($config) { |
|
| 23 | 102 | $functionName = 'set' . $config->camelize($key); |
|
| 24 | 102 | if (!is_callable([$config, $functionName])) { |
|
| 25 | 1 | throw new InvalidArgumentException(sprintf(Message::SETTER_NOT_IMPLEMENTED, $key)); |
|
| 26 | } |
||
| 27 | 101 | $config->$functionName($value); |
|
| 28 | 105 | } |
|
| 29 | ); |
||
| 30 | |||
| 31 | 104 | return $config; |
|
| 32 | } |
||
| 58 |