src/request/PageMapper.php
private function uriKeyExists($nextUriPart, array $pageMap) {
    if (array_key_exists($nextUriPart, $pageMap)) {
      return $nextUriPart;
    }
    $keys = array_keys($pageMap);
    $variableParts = array_values(preg_grep('/\{(.*)\}/', $keys));
    $variablePartsCount = count($variableParts);
    if ($variablePartsCount === 0) {
      return null;
    } elseif ($variablePartsCount > 1) {
      throw new RoutingException('Single node has more than one variable key');
    }
    $variablePartRaw = $variableParts[0];
    $variablePart = preg_replace(['/\{/', '/\}/'], '', $variablePartRaw);
    if (array_key_exists($variablePart, $this->uriVariables)) {
      throw new RoutingException('a key named ' . $variablePart . ' appears more than once on a single route');
    }
    $this->uriVariables[$variablePart] = $nextUriPart;
    return $variablePartRaw;
  }
private function uriKeyExists($nextUriPart, array $pageMap) {
    if (array_key_exists($nextUriPart, $pageMap)) {
      return $nextUriPart;
    }
    $keys = array_keys($pageMap);
    $variableParts = array_values(preg_grep('/\{(.*)\}/', $keys));
    $variablePartsCount = count($variableParts);
    if ($variablePartsCount === 0) {
      return null;
    } elseif ($variablePartsCount > 1) {
      throw new RoutingException('Single node has more than one variable key');
    }
    $variablePartRaw = $variableParts[0];
    $variablePart = preg_replace(['/\{/', '/\}/'], '', $variablePartRaw);
    if (array_key_exists($variablePart, $this->uriVariables)) {
      throw new RoutingException('a key named ' . $variablePart . ' appears more than once on a single route');
    }
    $this->uriVariables[$variablePart] = $nextUriPart;
    return $variablePartRaw;
  }
private function uriKeyExists ( $ nextUriPart , array $ pageMap ) { if ( array_key_exists ( $ nextUriPart , $ pageMap ) ) { return $ nextUriPart ; } $ keys = array_keys ( $ pageMap ) ; $ variableParts = array_values ( preg_grep ( '/\{(.*)\}/' , $ keys ) ) ; $ variablePartsCount = count ( $ variableParts ) ; if ( $ variablePartsCount === 0 ) { return null ; } elseif ( $ variablePartsCount > 1 ) { throw new RoutingException ( 'Single node has more than one variable key' ) ; } $ variablePartRaw = $ variableParts [ 0 ] ; $ variablePart = preg_replace ( [ '/\{/' , '/\}/' ] , '' , $ variablePartRaw ) ; if ( array_key_exists ( $ variablePart , $ this -> uriVariables ) ) { throw new RoutingException ( 'a key named ' . $ variablePart . ' appears more than once on a single route' ) ; } $ this -> uriVariables [ $ variablePart ] = $ nextUriPart ; return $ variablePartRaw ; }
Checks, if there is a key in the page map for the given uri part. If there is a wildcard in the url,
it will save the wildcard + it's value

@param string $nextUriPart
@param array $pageMap
@return string|null the key, if there is any, {@code null} else
@throws RoutingException if a variable in the url appears twice on a single part
Checks if there is a key in the page map for the given uri part . If there is a wildcard in the url it will save the wildcard + it s value