| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function register($name, $handler) |
||
| 14 | { |
||
| 15 | if (array_key_exists($name, $this->description)) { |
||
| 16 | throw new Exception("Mapper $name was registered"); |
||
| 17 | } |
||
| 18 | |||
| 19 | if ($handler instanceof Mapper) { |
||
| 20 | $this->description[$name] = $handler; |
||
| 21 | $this->mappers[$name] = $handler; |
||
| 22 | return; |
||
| 23 | } |
||
| 24 | |||
| 25 | if (!is_callable($handler)) { |
||
| 26 | throw new Exception("Invalid $name handler"); |
||
| 27 | } |
||
| 28 | |||
| 29 | $this->description[$name] = $handler; |
||
| 30 | return $this; |
||
| 31 | } |
||
| 32 | |||
| 64 |