protected function swapKeys(array $aliases, array $map)
    {
        return array_map(function ($alias) use ($map) {
            foreach ($map as $from => $to) {
                if (isset($alias[$from])) {
                    $alias[$to] = $alias[$from];
                    unset($alias[$from]);
                }
            }

            return $alias;
        }, $aliases);
    }