| Total Complexity | 6 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Updater |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @SuppressWarnings(PHPMD.BooleanArgumentFlag) |
||
| 14 | * |
||
| 15 | * @param array $patches |
||
| 16 | * @param array|bool|string $update |
||
| 17 | * @param bool $onlyNew |
||
| 18 | * @return array |
||
| 19 | */ |
||
| 20 | public function embedInfoToItems(array $patches, $update, $onlyNew = false) |
||
| 21 | { |
||
| 22 | foreach ($patches as $target => $group) { |
||
| 23 | foreach (array_keys($group) as $path) { |
||
| 24 | $patches[$target][$path] = is_array($update) |
||
| 25 | ? array_replace( |
||
| 26 | $patches[$target][$path], |
||
| 27 | $onlyNew ? array_diff_key($update, array_filter($patches[$target][$path])) : $update |
||
| 28 | ) |
||
| 29 | : $update; |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | return $patches; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function updateStatuses(array $patches, $status) |
||
| 45 | } |
||
| 46 | } |
||
| 47 |