Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2.2109 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function create(string $name, array $config): Dictionary |
||
21 | { |
||
22 | if (!isset($config['dictionaries'])) { |
||
23 | throw new \InvalidArgumentException(\sprintf( |
||
24 | 4 | 'Dictionary of type %s must contains a key "dictionaries".', |
|
25 | self::TYPE |
||
26 | 4 | )); |
|
27 | 4 | } |
|
28 | |||
29 | 1 | $dictionaries = array_map( |
|
30 | fn ($name): Dictionary => $this->collection[$name], |
||
31 | 1 | $config['dictionaries'] |
|
32 | ); |
||
33 | |||
34 | return new Dictionary\Combined($name, ...$dictionaries); |
||
35 | } |
||
42 |