| Conditions | 5 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | protected function cloneToMany($array, $parentObject = null, $parentName = null) |
||
| 28 | { |
||
| 29 | $newArray = []; |
||
| 30 | foreach ($array as $item) { |
||
| 31 | if (is_object($item)) { |
||
| 32 | $clone = clone $item; |
||
| 33 | if ($parentName !== null) { |
||
| 34 | $method = 'set' . ucfirst($parentName); |
||
| 35 | if (method_exists($clone, $method)) { |
||
| 36 | $clone->$method($parentObject); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | $newArray[] = $clone; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | return $newArray; |
||
| 43 | } |
||
| 44 | } |
||
| 45 |