Example #1
0
 /**
  * Matches given variables against given matchers and returns
  * if all vars pass all matchers.
  *
  * @param Route $route The route to test the values against
  * @param array $params The names variables and values
  * @return bool
  */
 protected function matchParams(Route $route, array $params) : bool
 {
     $matchers = $route->getMatchers();
     foreach ($params as $name => $value) {
         if (!isset($matchers[$name])) {
             continue;
         }
         $valueMatchers = $matchers[$name];
         foreach ($valueMatchers as $matcher) {
             if (!$matcher($value)) {
                 $this->logger->debug(sprintf('Value "%s" for param "%s" did not match criteria of matcher "%s"', $value, $name, get_class($matcher)));
                 return false;
             }
         }
     }
     return true;
 }