| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.0261 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 16 | public function add($alias, FormatInterface $handler) |
|
| 15 | { |
||
| 16 | 16 | if(false === \is_string($alias)) { |
|
| 17 | 1 | throw new \InvalidArgumentException('Format alias must be a string.'); |
|
| 18 | } |
||
| 19 | 15 | if(array_key_exists($alias, $this->formats)) { |
|
| 20 | throw new \InvalidArgumentException(sprintf('Format with alias `%s` already exists.', $alias)); |
||
| 21 | } |
||
| 22 | |||
| 23 | 15 | $this->formats[$alias] = $handler; |
|
| 24 | 15 | } |
|
| 25 | |||
| 35 |