Example #1
0
 /**
  * Pull the variables out of a path given the actual path and the
  * path that is is representing.
  * @param string $pathToMatch The path that is being matched.
  * @param Route $route The route to use.
  * @return array
  */
 private static function pullVariables($pathToMatch, Route $route)
 {
     $rtn = array();
     $pathToMatch = self::fixPath($pathToMatch);
     $nameMatches = array();
     $valueMatches = array();
     preg_match_all(self::IDENT_PREG, $route->getPath(), $nameMatches, PREG_PATTERN_ORDER);
     preg_match_all($route->getRegexPath(), $pathToMatch, $valueMatches, PREG_PATTERN_ORDER);
     for ($i = 0; $i < count($nameMatches[1]); $i++) {
         $value = $valueMatches[$i + 1][0];
         $rtn = array_merge($rtn, array($nameMatches[1][$i] => $value));
     }
     return $rtn;
 }