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