Conditions | 4 |
Paths | 3 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 4.3731 |
Changes | 0 |
1 | <?php |
||
28 | 22 | public function add($id, $converter) |
|
29 | { |
||
30 | 22 | if (!($converter instanceof ValueConverterInterface || $converter instanceof ItemConverterInterface)) { |
|
31 | throw new \InvalidArgumentException('Converter must implement ValueConverterInterface or ItemConverterInterface'); |
||
32 | } |
||
33 | 22 | if (empty($id)) { |
|
34 | throw new \InvalidArgumentException('Id cannot be empty'); |
||
35 | } |
||
36 | |||
37 | 22 | $this->converters[$id] = $converter; |
|
38 | |||
39 | 22 | return $this; |
|
40 | } |
||
41 | |||
53 |