| Conditions | 4 |
| Paths | 2 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 78 | 13 | private function mapToCommandObject(array $row) |
|
| 79 | { |
||
| 80 | 13 | $mappedObject = new Command($row['key']); |
|
| 81 | |||
| 82 | 13 | unset($row['key']); |
|
| 83 | |||
| 84 | 13 | if (!empty($row)) { |
|
| 85 | 13 | foreach ($row as $key => $value) { |
|
| 86 | 13 | $methodName = 'set'.ucwords($key); |
|
| 87 | |||
| 88 | // check setter exists |
||
| 89 | 13 | if (!method_exists($mappedObject, $methodName)) { |
|
| 90 | 1 | continue; |
|
| 91 | } |
||
| 92 | |||
| 93 | 13 | $mappedObject->$methodName($value); |
|
| 94 | } |
||
| 95 | } |
||
| 96 | |||
| 97 | 13 | return $mappedObject; |
|
| 98 | } |
||
| 99 | } |
||
| 100 |