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