Returns key/value pairs of a list of url's.

@param string[] $urls
@param string $mode
@return array
964038
public function getAliasingMap($urls, $mode)
    {
        if (0 === count($urls)) {
            return [];
        }

        switch ($mode) {
            case 'internal-to-public':
                $from = 'internal_url';
                $to = 'public_url';
                break;
            case 'public-to-internal':
                $from = 'public_url';
                $to = 'internal_url';
                break;
            default:
                throw new \InvalidArgumentException("Invalid mode supplied: {$mode}");
        }

        $connection = $this->manager->getConnection()->getWrappedConnection();

        $sql = sprintf(
            'SELECT %1$s, %2$s FROM url_alias WHERE mode=%3$d AND %1$s IN(%4$s)',
            $from,
            $to,
            UrlAlias::REWRITE,
            join(
                ', ',
                array_map(
                    function ($v) use ($connection) {
                        return $connection->quote($v, \PDO::PARAM_STR);
                    },
                    $urls
                )
            )
        );

        if ($stmt = $connection->query($sql)) {
            return $stmt->fetchAll(\PDO::FETCH_KEY_PAIR);
        }
        return [];
    }
1039484
function levelsToSelect($levelIds, $mode)
    {
        $levelsToSelect = array();
        foreach ($this->schema->getLevels() as $level) {
            if (self::INCLUDE_PARTIALS == $mode && !$levelIds[$level]) {
                continue;
            }
            if (self::INCLUDE_PARTIALS == $mode && !$levelIds[$level]) {
                continue;
            }
            array_push($levelsToSelect, $level);
        }
        return $levelsToSelect;
    }
462230
public function getUrlSegments() : array
    {
        $newUrl = str_replace('/'.Router::$indexPage, '', rtrim($this->getCurrentUri()));

        return array_filter(explode('/', $newUrl));
    }
950991
public function lookup($url)
  {
    $result = array();
    // get url's to check
    $canon_url = GoogleSafeBrowsing_Lookup_URL::googleCanonicalize($url);
    if(is_null($canon_url)){
      // unable to canonicalize, nothing we can do
      $this->debugLog('lookup('.$url.'): cannot canonicalize url, skipping');
      return $result;
    }
    $lookup_urls = GoogleSafeBrowsing_Lookup_URL::googleGetLookupExpressions($canon_url);
    
    $lookup_hashes = array();
    foreach($lookup_urls as $lookup_url){
      $lookup_hashes[]=GoogleSafeBrowsing_Lookup_URL::hash($lookup_url);
      //$this->debugLog(bin2hex($lookup_hashes[count($lookup_hashes)-1])." $lookup_url");
    }
    
    $found_hashes=$this->storage->hasPrefix($lookup_hashes);
    
    $matched_lists=array();
    // full hash lookups
    foreach($found_hashes as $found_hash){
      $this->debugLog('lookup('.$url.'): found hash prefix for '.bin2hex($found_hash));
      $lookup_result=$this->storage->isListedInCache($found_hash);
      if(is_null($lookup_result)){
        $lookup_result=array();
        // not cached, query google
        $collection=$this->api->getHash(substr($found_hash,0,4),$this->storage->getLists());
        if(count($collection->list_hashes)==0){
          // no hashes found, can happen, so insert dummy record for this prefix
          // so we can use the cached result (empty)
          $this->storage->addHashInCache($found_hash,$lookup_result,null,(int)$collection->cache);
        }else{
          // full length hashes found
          foreach($collection->list_hashes as $list_hash){
            $this->debugLog('lookup('.$url.'): remote lookup found full length hashes in list '.$list_hash->list_name);
            foreach($list_hash->hashes as $hash){
              $this->debugLog('lookup('.$url.'):   hash '.bin2hex($hash->hash));
              // cache in db
              $cache_seconds=(int)$collection->cache;
              if(isset($hash->cache) && $hash->cache){
                $cache_seconds=(int)$hash->cache;
              }
              $this->storage->addHashInCache($hash->hash,array($list_hash->list_name),$hash->raw_meta,$cache_seconds);
              if($hash->hash==$found_hash){
                // full length hash match
                if(!in_array($list_hash->list_name, $lookup_result)){
                  $lookup_result[]=$list_hash->list_name;
                }
              }
            }
          }
        }
      }// end cached if/else
      // $lookup_result is array of listnames (can be empty if not listed)
      foreach($lookup_result as $matched_list){
        $matched_lists[$matched_list]=true;
      }
    }
    if(count($matched_lists)>0){
      $this->debugLog('lookup('.$url.'): listed in '.implode(', ',array_keys($matched_lists)));
    }
    return array_keys($matched_lists);
  }
1261858
public function getTagsMultiple(array $keys): array
    {
        if (!is_iterable($keys)) {
            throw new CacheException('Argument $keys is not iterable.');
        }
        if (!count($keys)) {
            return [];
        }
        $keys = array_unique($keys);
        $this->validateKeys($keys);
        $return = $this->client->evalsha(
            $this->scripts[self::SCRIPT_GET_TAGS],
            count($keys),
            ...$keys,
            ...[
                self::PREFIX_KEY_VALUE,
                self::PREFIX_KEY_TAGS,
            ]
        );
        return array_map(function ($value) {
            return $value === 0 ? null : $value;
        }, array_combine($keys, $return));
    }
216673
public function normalizeUrl($urls, $verb = 'GET'): array
    {
        $removeSlash = function ($url) use ($verb) {
            return $verb.ltrim($url, '/');
        };

        return array_map($removeSlash, $urls);
    }
27691
private function getMatchingRoutes( string $uri, $routes ) : array
	{
		$router = new OptionsRouter( $routes );

		return $router->findMatchingRoutes( $uri );
	}
426519
public static function getConfiguredUrls()
    {
        $result = array();
        foreach (self::$urlOptions as $key => $optionName) {
            $result[$key] = Option::get($optionName);
        }
        return $result;
    }
1035376
public function url($value, array $options, $mode) {
        if ($mode === self::TO && $options['encode']) {
            return urlencode($value);
        }

        if ($mode === self::FROM && $options['decode']) {
            return urldecode($value);
        }

        return $value;
    }
426460
public function getAllSectionRouteRules(string $format = 'Craft', $siteId = null): array
    {
        $routeRules = [];
        // Get all of the sections
        $sections = Craft::$app->getSections()->getAllSections();
        foreach ($sections as $section) {
            $routes = $this->getSectionRouteRules($section->handle, $format, $siteId);
            if (!empty($routes)) {
                $routeRules[$section->handle] = $routes;
            }
        }

        return $routeRules;
    }
995942
def [](url)
      interpret case
        when store.respond_to?(:[])
          store[key_for(url)]
        when store.respond_to?(:get)
          store.get key_for(url)
        when store.respond_to?(:read)
          store.read key_for(url)
      end
    end
1176495
public function getAll($urls)
    {
        $this->wildCardHosts = array_filter(array_keys($this->services), function($key) {
            return (strpos($key, '*') !== false);
        });

        return $this->findServices((array) $urls);
    }
962922
private List<String> getModes() {

        List<String> modes = new ArrayList<String>();
        try {
            modes = CmsStringUtil.splitAsList(getMode(), SEPARATOR_MODES, true);
        } catch (Exception e) {
            // error generating list, an empty list will be returned
        }

        return modes;
    }
1147590
protected function getUrl($entity, $mode)
    {
        return $this->generateUrl($this->route_name.$mode, array('id' => $entity->getId()));
    }
1317098
private function getTrackerHosts($urls)
    {
        $hosts = array();
        foreach ($urls as $url) {
            $url = parse_url($url);
            if (isset($url['host'])) {
                $hosts[] = $url['host'];
            }
        }
        return $hosts;
    }
37331
public function findSiteBy(array $params, $mode = AbstractQuery::HYDRATE_OBJECT)
    {
        /** @var $query QueryBuilder */
        $qb = $this->getFindByQueryBuilder($params, null, 'e');
        $qb->addSelect('x,y,z,a,l')
            ->innerJoin('e.siteType', 'x')
            ->leftJoin('e.parent', 'z')
            ->leftJoin('e.subDomains', 'a')
            ->leftJoin('e.linkedSites', 'l')
            ->leftJoin('e.rootPage', 'y');

        if ($mode != AbstractQuery::HYDRATE_OBJECT) {
            $qb->setEnableHydrationCache($this->isEnableResultCache());
        }

        $site = $qb->getQuery()->getOneOrNullResult($mode);

        return $site;
    }
191442
protected function _matchUrl($url, array $regexRules) {
		foreach ($regexRules as $regexRule) {
			if (preg_match('~' . $regexRule . '~imu', $url, $match)) {
				return $match;
			}
		}
		return [];
	}