| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 5 | public function create(string $name, array $config): Dictionary |
|
| 23 | 5 | { |
|
| 24 | if (!isset($config['content'])) { |
||
| 25 | throw new \InvalidArgumentException(\sprintf( |
||
| 26 | 'The key content for dictionary %s must be set.', |
||
| 27 | $name |
||
| 28 | )); |
||
| 29 | } |
||
| 30 | 2 | ||
| 31 | $content = $config['content']; |
||
| 32 | 2 | $values = []; |
|
| 33 | 1 | ||
| 34 | 1 | foreach ($content as $key => $value) { |
|
| 35 | $builtValue = $this->valueTransformer->transform($value); |
||
| 36 | $key = $this->valueTransformer->transform($key); |
||
| 37 | $values[$key] = $builtValue; |
||
| 38 | } |
||
| 39 | 1 | ||
| 40 | 1 | return new Simple($name, $values); |
|
| 41 | } |
||
| 48 |