private function prepareMappings(array $mappings, array $availableMappings, DefaultMappingHelper $helper) { $availableMappings = array_combine($availableMappings, $availableMappings); return array_map(function ($className) use($mappings, $helper) { return $helper->findMappingByClassName($mappings, $className) ?: Configuration::getMappingDefaults(); }, $availableMappings); }
private function mergeMapping(array $highPriorityMappings, array $lowPriorityMappings) { $mappings = array_reverse(array_merge($highPriorityMappings, $lowPriorityMappings)); if (empty($mappings)) { return false; } $defaults = Configuration::getMappingDefaults(); $result = $defaults; foreach ($mappings as $mapping) { foreach ($mapping as $key => $value) { if ($defaults[$key] === $value) { continue; } $result[$key] = $value; } } return $result; }