| Conditions | 7 |
| Paths | 4 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function getDocumentFieldValue($entity) |
||
| 14 | { |
||
| 15 | $result = []; |
||
| 16 | $entityValue = $this->getEntityFieldValue($entity); |
||
| 17 | if (!is_null($entityValue)) { |
||
| 18 | if (is_scalar($entityValue)) { |
||
| 19 | $entityValue = [ $entityValue ]; |
||
| 20 | } elseif ( |
||
| 21 | !is_array($entityValue) && |
||
| 22 | ((!$entityValue instanceof \Iterator) && (!$entityValue instanceof \IteratorAggregate)) |
||
| 23 | ) { |
||
| 24 | throw new InvalidFieldValueException('Field value must be \Iterator or \IteratorAggregate instance'); |
||
| 25 | } |
||
| 26 | |||
| 27 | foreach ($entityValue as $value) { |
||
| 28 | $result[] = strval($value); |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | return $result; |
||
| 33 | } |
||
| 34 | } |