| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function build($object) |
||
| 16 | { |
||
| 17 | if (! is_object($object)) { |
||
| 18 | return $object; |
||
| 19 | } |
||
| 20 | |||
| 21 | foreach ($this->options->transformers as $type => $transformer) { |
||
| 22 | if (is_a($object, $type)) { |
||
| 23 | return (new $transformer($object))->toArray(); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | throw new Exception('Transformer not found for type '.get_class($object).'.'); |
||
| 28 | } |
||
| 30 |