| Conditions | 5 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 5.2742 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | 1 | public function map(array $record_set) |
|
| 37 | { |
||
| 38 | 1 | foreach ($record_set as $index => &$record) { |
|
| 39 | 1 | if (! is_array($record)) { |
|
| 40 | throw new UnexpectedValueException("unexpected record type: " . gettype($record)); |
||
| 41 | } |
||
| 42 | |||
| 43 | 1 | foreach ($this->types as $name => $type) { |
|
| 44 | 1 | if (! array_key_exists($name, $record)) { |
|
| 45 | throw new OutOfBoundsException("undefined record field: {$name}"); |
||
| 46 | } |
||
| 47 | |||
| 48 | 1 | $record[$name] = $type->convertToPHP($record[$name]); |
|
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | 1 | return $record_set; |
|
| 53 | } |
||
| 54 | } |
||
| 55 |