Conditions | 6 |
Paths | 6 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
29 | public function toArray() |
||
30 | { |
||
31 | if ($this->object instanceof MetadataInterface) { |
||
32 | return $this->object->getMetadata(); |
||
33 | } elseif ($this->object instanceof ArrayConvertableInterface) { |
||
34 | return $this->object->toArray(); |
||
35 | } elseif ($this->object instanceof \ArrayIterator) { |
||
36 | return $this->object->getArrayCopy(); |
||
37 | } elseif ($this->object instanceof \ArrayObject) { |
||
38 | return $this->object->getArrayCopy(); |
||
39 | } elseif ($this->object instanceof \Traversable) { |
||
40 | return iterator_to_array($this->object); |
||
41 | } else { |
||
42 | throw new \RuntimeException('Unable to get MetaData!'); |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 |