Renders alias

@param array $map array that specifies which variables should be mapped to which alias
@return string Rendered string
@api
176116
public function render(array $map)
    {
        foreach ($map as $aliasName => $value) {
            $this->templateVariableContainer->add($aliasName, $value);
        }
        $output = $this->renderChildren();
        foreach ($map as $aliasName => $value) {
            $this->templateVariableContainer->remove($aliasName);
        }
        return $output;
    }
735146
public static function hashMap($map)
    {
        $cache = '';
        foreach ($map as $key => $value) {
            $cache .= 0xAB01 . $key . 0xAB02;
            if (is_array($value)) {
                $cache .= 0xAB04 . static::hashMap($value);
            } else {
                $cache .= 0xAB03 . $value;
            }
        }
        return md5($cache);
    }
923487
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);
    }
868373
public function render(array $parameters = []): string
    {
        return $this->twig->render('@ezdesign/component/script.html.twig', [
            'src' => $this->src,
            'type' => $this->type,
            'async' => $this->async,
            'defer' => $this->defer,
            'crossorigin' => $this->crossorigin,
            'integrity' => $this->integrity,
        ] + $parameters);
    }
1114259
protected function getMappedKey($map, $key)
    {
        if (is_array($map)) {
            if (array_key_exists($key, $map)) {
                return $map[$key];
            } else {
                return $key;
            }
        }
        return $key;
    }
649399
public function render(Rectangle $rectangle, Map $map)
    {
        $formatter = $this->getFormatter();
        $jsonBuilder = $this->getJsonBuilder()
            ->setValue('[map]', $map->getVariable(), false)
            ->setValue('[bounds]', $rectangle->getBound()->getVariable(), false)
            ->setValues($rectangle->getOptions());

        return $formatter->renderObjectAssignment($rectangle, $formatter->renderObject('Rectangle', [
            $jsonBuilder->build(),
        ]));
    }
803790
protected function build(array $map) {
		$overrides = [];
		foreach ($map as $method => $array) {
			$mapDefinitions = $this->buildMapDefinitions($array);

			$overrides[] = <<<TXT
	override(
		$method,
		map([
$mapDefinitions
		])
	);
TXT;

		}
		$overrides = implode(PHP_EOL . PHP_EOL, $overrides);

		$template = <<<TXT
<?php
// @link https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata
namespace PHPSTORM_META {

$overrides

}

TXT;

		return $template;
	}
367836
public static function dsnClassMap(array $map = null)
    {
        deprecationWarning(
            get_called_class() . '::setDsnClassMap() is deprecated. ' .
            'Use setDsnClassMap()/getDsnClassMap() instead.'
        );

        if ($map !== null) {
            static::setDsnClassMap($map);
        }

        return static::getDsnClassMap();
    }
45453
public function _process($val, $map) {
		foreach ($map as $m => $arg) {
			if (is_numeric($m)) {
				$m = $arg;
				$arg = null;
			}

			if ($arg !== null) {
				$ret = call_user_func($m, $val, $arg);
			} else {
				$ret = call_user_func($m, $val);
			}

			if ($ret !== false) {
				$val = $ret;
			}
		}
		return $val;
	}
468784
public function supplant(array $map) {
		return new Text(str_replace(array_keys($map), array_values($map), $this->string), $this->encoding);
	}
831152
protected void renderGeneral(HashMap map, AbstractRenderAppender sb, boolean doubleQuote)
    {
        if (map == null)
            return;

        Iterator iterator = map.keySet().iterator();
        for (; iterator.hasNext();) {
            String key = (String) iterator.next();
            if (key == null)
                continue;

            String value = (String) map.get(key);
            if (doubleQuote)
                renderAttribute(sb, key, value);
            else
                renderAttributeSingleQuotes(sb, key, value);
        }
    }
619659
public function addAuthorMap($mapping)
    {
        foreach ($mapping as $author => $aliases) {
            if (\is_array($aliases)) {
                foreach ($aliases as $alias) {
                    $this->aliasAuthor($alias, $author);
                }
            } else {
                $this->aliasAuthor($aliases, $author);
            }
        }

        return $this;
    }
471704
private function renderArgument($argument)
    {
        if (is_array($argument)) {
            $argument = json_encode($argument);
        } elseif (null === $argument) {
            $argument = 'null';
        } elseif (is_string($argument)) {
            $argument = '"' . $argument . '"';
        }

        return $argument;
    }
46538
public function renderProductElementMap(array &$context)
	{
		$map = $this->renderer->getElementMap($context['product']['id'], $context['site']['id']);
		return $this->renderMap($map);
	}
1351295
protected function getReplacementKeys(array $map = [])
    {
        $keys = empty($map) ? array_keys($this->model->new_value) : array_keys($map);
        return array_map(function($current) {
            return '{' . $current . '}';
        }, $keys);
    }
757449
public function showAction(Map $map = null)
    {
        $categoriesArray = [];

        // get current map
        /* @var Map $map */
        $map = $map ?? $this->mapRepository->findByUid($this->settings['map']);

        // find addresses
        $addresses = $map->getAddresses();

        // no addresses related to the map, try to find some from the storagePid
        if($addresses->count() === 0 && $this->settings['storagePid']) {
            $pid = str_ireplace('this', $GLOBALS['TSFE']->id, $this->settings['storagePid']);
            $addresses = $this->addressRepository->findAllAddresses($map, $pid);
        }

        // get categories
        if ($map->isShowCategories()) {
            foreach ($addresses as $address) {
                /* @var \Clickstorm\GoMapsExt\Domain\Model\Address $address */
                $addressCategories = $address->getCategories();
                /* @var \Clickstorm\GoMapsExt\Domain\Model\Category $addressCategory */
                foreach ($addressCategories as $addressCategory) {
                    $categoriesArray[$addressCategory->getUid()] = $addressCategory;
                }
            }
        }

        $this->view->assignMultiple([
            'request' => $this->request->getArguments(),
            'map' => $map, 'addresses' => $addresses,
            'categories' => $categoriesArray,
            'googleMapsLibrary' => $this->googleMapsLibrary
        ]);
    }
776195
public static function mapsWith(array $map)
    {
        return self::tuples($map)->fmap(function ($vals) use ($map) {
            return array_combine(array_keys($map), $vals);
        });
    }