| Conditions | 4 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 6 | public function transform($value) |
|
| 28 | { |
||
| 29 | // not an array, must be traversable |
||
| 30 | 6 | if (!is_array($value) && !$value instanceof \Traversable) { |
|
| 31 | 2 | throw new TransformationFailedException( |
|
| 32 | 2 | sprintf('Expected an array or \Traversable to transform, got "%s" instead.', gettype($value)) |
|
| 33 | 2 | ); |
|
| 34 | } |
||
| 35 | |||
| 36 | // traverse through object, transforming each item |
||
| 37 | 4 | foreach ($value as $key => $val) { |
|
| 38 | 4 | $value[$key] = $this->transformer->transform($val); |
|
| 39 | 4 | } |
|
| 40 | |||
| 41 | 4 | return $value; |
|
| 42 | } |
||
| 43 | } |
||
| 44 |