| Conditions | 6 |
| Paths | 6 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 16.6682 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | 4 | public function toArray() |
|
| 30 | { |
||
| 31 | 4 | if ($this->object instanceof MetadataInterface) { |
|
| 32 | return $this->object->getMetadata(); |
||
| 33 | 4 | } elseif ($this->object instanceof ArrayConvertableInterface) { |
|
| 34 | 4 | 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 |