| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 13 |
| Ratio | 100 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | View Code Duplication | public function transform($array) |
|
| 27 | { |
||
| 28 | $className = $this->className; |
||
| 29 | $viewReference = new $className(); |
||
| 30 | foreach ($array['viewReference'] as $array) { |
||
| 31 | foreach ($array as $prop => $value) { |
||
| 32 | $methodName = 'set'.ucfirst($prop); |
||
| 33 | $viewReference->$methodName((string) $value); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | return $viewReference; |
||
| 38 | } |
||
| 39 | |||
| 59 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: