| Conditions | 5 | 
| Paths | 7 | 
| Total Lines | 32 | 
| Code Lines | 18 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 17 | public function process(array $patches, array $packagesByName) | ||
| 18 |     { | ||
| 19 | $validatedPatches = array(); | ||
| 20 | |||
| 21 |         foreach ($patches as $patchTarget => $packagePatches) { | ||
| 22 | $validItems = array(); | ||
| 23 | |||
| 24 |             foreach ($packagePatches as $data) { | ||
| 25 | $path = $data[PatchDefinition::PATH]; | ||
| 26 | |||
| 27 | $uidSources = array( | ||
| 28 | file_exists($path) ? md5_file($path) : '', | ||
| 29 | md5($data['source']), | ||
| 30 | serialize($data[PatchDefinition::DEPENDS]), | ||
| 31 | serialize($data[PatchDefinition::TARGETS]), | ||
| 32 | serialize($data[PatchDefinition::CONFIG]), | ||
| 33 | $data[PatchDefinition::LABEL] | ||
| 34 | ); | ||
| 35 | |||
| 36 |                 $data[PatchDefinition::HASH] = md5(implode('|', $uidSources)); | ||
| 37 | |||
| 38 | $validItems[] = $data; | ||
| 39 | } | ||
| 40 | |||
| 41 |             if (!$validItems) { | ||
| 42 | continue; | ||
| 43 | } | ||
| 44 | |||
| 45 | $validatedPatches[$patchTarget] = $validItems; | ||
| 46 | } | ||
| 47 | |||
| 48 | return $validatedPatches; | ||
| 49 | } | ||
| 51 |