| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 13 | 
| Code Lines | 7 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 7 | 
| CRAP Score | 4 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 73 | 2 | public function exchangeArray($data) | |
| 74 |     { | ||
| 75 | 2 | foreach ($data as $prop => $value) | |
| 76 |         { | ||
| 77 | 2 | if (property_exists($this, $prop)) | |
| 78 |             { | ||
| 79 | 2 | $this->$prop = $value; | |
| 80 | |||
| 81 | 2 | if (!in_array($prop, $this->changedFields)) | |
|  | |||
| 82 | 2 | $this->changedFields[] = $prop; | |
| 83 | } | ||
| 84 | else | ||
| 85 | 2 |                 throw new \LogicException("The property '$prop' does not exists in the class ' " . get_class($this) . " '"); | |
| 86 | } | ||
| 103 | } | 
Adding braces to control structures avoids accidental mistakes as your code changes: