Internal method for generating URL aliases.

@see \eZ\Bundle\EzPublishMigrationBundle\Command\LegacyStorage\RegenerateUrlAliasesCommand::generateLocationAliases()
176364
protected function doGenerateLocationAliases()
    {
        $totalLocationCount = $this->getTotalLocationCount();
        $totalContentCount = $this->getTotalLocationContentCount();
        $passCount = ceil($totalLocationCount / $this->bulkCount);
        $publishedAliasCount = 0;

        if ($totalLocationCount === 0) {
            $this->output->writeln('Could not find any Locations, nothing to generate.');
            $this->output->writeln('');

            return;
        }

        $queryBuilder = $this->connection->createQueryBuilder();
        $queryBuilder
            ->select('node_id', 'parent_node_id', 'contentobject_id')
            ->from('ezcontentobject_tree')
            ->where($queryBuilder->expr()->neq('node_id', 1))
            ->orderBy('depth', 'ASC')
            ->addOrderBy('node_id', 'ASC');

        $this->output->writeln(
            "Publishing URL aliases for {$totalLocationCount} Location(s) " .
            "with {$totalContentCount} Content item(s) in all languages."
        );

        $progressBar = $this->getProgressBar($totalLocationCount);
        $progressBar->start();

        for ($pass = 0; $pass <= $passCount; ++$pass) {
            $rows = $this->loadLocationData($queryBuilder, $pass);

            foreach ($rows as $row) {
                $publishedAliasCount += $this->publishAliases(
                    $row['node_id'],
                    $row['parent_node_id'],
                    $row['contentobject_id']
                );
            }

            $progressBar->advance(count($rows));
        }

        $progressBar->finish();

        $this->output->writeln('');
        $this->output->writeln("Done. Published {$publishedAliasCount} URL alias(es).");
        $this->output->writeln('');
    }
1027623
public function generateAliasesAcquia() {
    $this->cloudConfDir = $_SERVER['HOME'] . '/.acquia';
    $this->setAppId();
    $this->cloudConfFileName = 'cloud_api.conf';
    $this->cloudConfFilePath = $this->cloudConfDir . '/' . $this->cloudConfFileName;
    $this->siteAliasDir = $this->getConfigValue('drush.alias-dir');

    $cloudApiConfig = $this->loadCloudApiConfig();
    $this->setCloudApiClient($cloudApiConfig['key'], $cloudApiConfig['secret']);

    $this->say("<info>Gathering site info from Acquia Cloud.</info>");
    $site = $this->cloudApiClient->application($this->appId);

    $error = FALSE;
    try {
      $this->getSiteAliases($site);
    }
    catch (\Exception $e) {
      $error = TRUE;
      $this->logger->error("Did not write aliases for $site->name. Error: " . $e->getMessage());
    }
    if (!$error) {
      $this->say("<info>Aliases were written, type 'drush sa' to see them.</info>");
    }
  }
719553
function alias($name,$params=[],$query=NULL) {
		if (!is_array($params))
			$params=$this->parse($params);
		if (empty($this->hive['ALIASES'][$name]))
			user_error(sprintf(self::E_Named,$name),E_USER_ERROR);
		$url=$this->build($this->hive['ALIASES'][$name],$params);
		if (is_array($query))
			$query=http_build_query($query);
		return $url.($query?('?'.$query):'');
	}
970309
public function generateUrl($originalUrl, $filtersOrConfigurationKey = [], array $extraFilters = [])
    {
        $filters = $this->prepareFilterParams($filtersOrConfigurationKey, $extraFilters);

        return $this->urlGenerator->generateUrl($originalUrl, $filters);
    }
296654
public function andWhere(...$args): AliasDecorator
    {
        if ($args[0] instanceof \Closure) {
            call_user_func($args[0], $this);

            return $this;
        }

        //We have to prepare only first argument
        $args[0] = $this->prepare($args[0]);

        //Routing where
        call_user_func_array([$this->query, 'and' . ucfirst($this->target)], $args);

        return $this;
    }
571212
private function createAddressUrl()
	{
		$urlVariables = [
			'language' => $this->locale,
		];

		if(count($this->isos)) {
			$urlVariables['components'] = 'country:'.implode(',', $this->isos);
		}

		// if true it will always be the final stage in getting the address
		if($this->returnLocationData['latitude'] && $this->returnLocationData['longitude']) {
			$urlVariables['latlng'] = $this->returnLocationData['latitude'].','.$this->returnLocationData['longitude'];
			return $this->buildUrl($urlVariables);
		}

		if($this->returnLocationData['city'] && $this->returnLocationData['country']) {
			$urlVariables['address'] = $this->returnLocationData['city'].', '.$this->returnLocationData['country'];
			return $this->buildUrl($urlVariables);
		}

		if($this->returnLocationData['postal_code']) {
			$urlVariables['address'] = $this->returnLocationData['postal_code'].(($this->returnLocationData['street_number']) ? ' '.$this->returnLocationData['street_number'] : '');
			return $this->buildUrl($urlVariables);
		}


	}
1273127
final protected function buildUrl($fragments)
    {
        // Verify url path
        if (!isset($fragments[0])) {
            throw new InvalidFragmentsParameter('Invalid base url structure, http:// path must exists at position [0]', 1);
        }

        // Cleaning up
        $url = $fragments[0];
        unset($fragments[0]);

        // Begin process for make replacements
        if (isset($fragments[1]) && is_array($fragments[1])) {
            $replacements = [];
            $params = $fragments[1];

            // Add { } to each element of the array
            array_walk($params, function (&$item, $key) use (&$replacements) {
                $replacements['{'.$key.'}'] = $item;
            });
        }

        return str_replace(array_keys($replacements), array_values($replacements), $url);
    }
629532
private function buildUrl($urlVariables)
	{
		$url = '';

		foreach($urlVariables as $variable => $value) {
			$url .= '&'.$variable.'='.($value);
		}
		return config('location.google-maps-url').env('GOOGLE_KEY').$url;
	}
168574
public static function alias( $alias, $params = array(), $retain = false )
	{
		$route_params = array();
		
		// to handle the suffix after a slash in an alias define
		$suffix = '';
		
		if ( strpos( $alias, '/' ) !== false && $alias !== '/' )
		{
			// slashes in aliases get appended as suffix
			list( $alias, $suffix ) = explode( '/', $alias );
			
			$suffix = '/'.$suffix;
		}
	

		// get the parameters with the numeric keys so we can 
		// pass them as route parameters like [any]-[num]-[num]/[any]/
		foreach( $params as $key => $value )
		{
			if ( is_int( $key ) )
			{
				$route_params[] = $value; unset( $params[$key] );
			}
		}

		return CCUrl::to( CCRouter::alias( $alias, $route_params ).$suffix, $params, $retain );
	}
1049750
public function redirectLocation(Request $request)
    {
        if ($request->query->has('id')) {
            $location = $this->locationService->loadLocation($request->query->get('id'));
        } elseif ($request->query->has('remoteId')) {
            $location = $this->locationService->loadLocationByRemoteId($request->query->get('remoteId'));
        } elseif ($request->query->has('urlAlias')) {
            $urlAlias = $this->urlAliasService->lookup($request->query->get('urlAlias'));
            $location = $this->locationService->loadLocation($urlAlias->destination);
        } else {
            throw new BadRequestException("At least one of 'id', 'remoteId' or 'urlAlias' parameters is required.");
        }

        return new Values\TemporaryRedirect(
            $this->router->generate(
                'ezpublish_rest_loadLocation',
                array(
                    'locationPath' => trim($location->pathString, '/'),
                )
            )
        );
    }
36705
protected function generateLoc($hostWithScheme, $route, $parameters = [])
    {
        if (null === $this->router) {
            throw new \RuntimeException('UrlGenerator interface is missing');
        }

        list($scheme, $host) = explode('://', $hostWithScheme);

        $this->router
            ->getContext()
            ->setHost($host)
            ->setScheme($scheme);

        return $this->router->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_URL);
    }
15399
private function generateIdentifiersUrl(array $identifiers, string $resourceClass): array
    {
        if (0 === \count($identifiers)) {
            throw new InvalidArgumentException(sprintf(
                'No identifiers defined for resource of type "%s"',
                $resourceClass
            ));
        }

        if (1 === \count($identifiers)) {
            return [rawurlencode((string) reset($identifiers))];
        }

        foreach ($identifiers as $name => $value) {
            $identifiers[$name] = sprintf('%s=%s', $name, $value);
        }

        return array_values($identifiers);
    }
1073283
public function generateUrl( array $arguments = null )
    {
        // ezpRestPrefixFilterInterface::getScheme() ==> '/v'
        $apiPrefix = ezpRestPrefixFilterInterface::getApiPrefix() . '/';
        $apiProviderName = ezpRestPrefixFilterInterface::getApiProviderName();

        return $apiPrefix . ( !$apiProviderName ? ''  : $apiProviderName . '/' ) . 'v' . $this->version . '/' . str_replace( $apiPrefix, '', $this->route->generateUrl( $arguments ) );
    }
995154
protected function registerAliases() : void
    {
        $aliases = [
            'bitcoind'         => 'Denpa\Bitcoin\ClientFactory',
            'bitcoind.client'  => 'Denpa\Bitcoin\LaravelClient',
        ];

        foreach ($aliases as $key => $aliases) {
            foreach ((array) $aliases as $alias) {
                $this->app->alias($key, $alias);
            }
        }
    }
724629
protected function doBackupCustomLocationAliases()
    {
        $totalCount = $this->getTotalLocationCount();
        $passCount = ceil($totalCount / $this->bulkCount);
        $customAliasCount = 0;
        $customAliasPathCount = 0;

        if ($totalCount === 0) {
            $this->output->writeln('Could not find any Locations, nothing to backup.');
            $this->output->writeln('');

            return;
        }

        $queryBuilder = $this->connection->createQueryBuilder();
        $queryBuilder
            ->select('node_id', 'parent_node_id', 'contentobject_id')
            ->from('ezcontentobject_tree')
            ->where($queryBuilder->expr()->neq('node_id', 1))
            ->orderBy('depth', 'ASC')
            ->addOrderBy('node_id', 'ASC');

        $this->output->writeln("Backing up custom URL alias(es) for {$totalCount} Location(s).");

        $progressBar = $this->getProgressBar($totalCount);
        $progressBar->start();

        for ($pass = 0; $pass <= $passCount; ++$pass) {
            $rows = $this->loadLocationData($queryBuilder, $pass);

            foreach ($rows as $row) {
                $customAliases = $this->urlAliasHandler->listURLAliasesForLocation(
                    $row['node_id'],
                    true
                );

                $customAliasCount += count($customAliases);
                $customAliasPathCount += $this->storeCustomAliases($customAliases);
            }

            $progressBar->advance(count($rows));
        }

        $progressBar->finish();

        $this->output->writeln('');
        $this->output->writeln(
            "Done. Backed up {$customAliasCount} custom URL alias(es) " .
            "with {$customAliasPathCount} path(s)."
        );
        $this->output->writeln('');
    }
1338610
public function setupDrushRemoteAliases()
    {
        $project_root = ProjectX::projectRoot();
        $drush_aliases_dir = "$project_root/drush/site-aliases";

        foreach (ProjectX::getRemoteEnvironments() as $realm => $environment) {
            $file_task = $this
                ->taskWriteToFile("$drush_aliases_dir/$realm.aliases.drushrc.php");

            $has_content = false;
            for ($i = 0; $i < count($environment); $i++) {
                $instance = $environment[$i];

                if (!isset($instance['name'])
                    || !isset($instance['path'])
                    || !isset($instance['uri'])
                    || !isset($instance['ssh_url'])) {
                    continue;
                }
                list($ssh_user, $ssh_host) = explode('@', $instance['ssh_url']);

                $options = [
                    'remote_user' => $ssh_user,
                    'remote_host' => $ssh_host
                ];

                $content = $this->drushAliasFileContent(
                    $instance['name'],
                    $instance['uri'],
                    $instance['path'],
                    $options,
                    $i === 0
                );
                $has_content = true;

                $file_task->line($content);
            }

            if ($has_content) {
                $file_task->run();
            }
        }

        return $this;
    }
1219267
def _generateAlias(self):
        """"""
        for i in range(1000):
            alias = 'cust%d' % (i, )
            if alias not in self.auth_level_aliases:
                return alias

        raise RuntimeError('Could not find an unused alias (tried 1000!)')