| Conditions | 4 |
| Paths | 6 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 2 | public function __construct(string $key, array $fieldMappers, string $outputKey = '') |
|
| 21 | { |
||
| 22 | 2 | $this->key = $key; |
|
| 23 | 2 | $this->outputKey = $outputKey; |
|
| 24 | |||
| 25 | 2 | if ('' === $outputKey) { |
|
| 26 | 2 | $this->outputKey = $key; |
|
| 27 | } |
||
| 28 | 2 | foreach ($fieldMappers as $mapper) { |
|
| 29 | 2 | if (array_key_exists($mapper->key(), $this->mappers)) { |
|
| 30 | 1 | throw new MapperRepetitionException('Mapper with key: ' . $mapper->key() . ' already exists'); |
|
| 31 | } |
||
| 32 | 2 | $this->mappers[$mapper->key()] = $mapper; |
|
| 33 | } |
||
| 34 | 2 | } |
|
| 35 | |||
| 66 |