handleRouteRequirements example

$hasTrailingVar = false;
                }
            }

            $hostMatches = [];
            if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex()$this->context->getHost()$hostMatches)) {
                continue;
            }

            $attributes = $this->getAttributes($route$namearray_replace($matches$hostMatches));

            $status = $this->handleRouteRequirements($pathinfo$name$route$attributes);

            if (self::REQUIREMENT_MISMATCH === $status[0]) {
                continue;
            }

            if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
                if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) {
                    return $this->allow = $this->allowSchemes = [];
                }
                continue;
            }

            
$hasTrailingVar = false;
                }
            }

            $hostMatches = [];
            if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex()$this->context->getHost()$hostMatches)) {
                continue;
            }

            $attributes = $this->getAttributes($route$namearray_replace($matches$hostMatches));

            $status = $this->handleRouteRequirements($pathinfo$name$route$attributes);

            if (self::REQUIREMENT_MISMATCH === $status[0]) {
                continue;
            }

            if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
                if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) {
                    return $this->allow = $this->allowSchemes = [];
                }
                continue;
            }

            

            }

            $hostMatches = [];
            if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex()$this->context->getHost()$hostMatches)) {
                $this->addTrace(sprintf('Host "%s" does not match the requirement ("%s")', $this->context->getHost()$route->getHost()), self::ROUTE_ALMOST_MATCHES, $name$route);
                continue;
            }

            $attributes = $this->getAttributes($route$namearray_replace($matches$hostMatches));

            $status = $this->handleRouteRequirements($pathinfo$name$route$attributes);

            if (self::REQUIREMENT_MISMATCH === $status[0]) {
                $this->addTrace(sprintf('Condition "%s" does not evaluate to "true"', $route->getCondition()), self::ROUTE_ALMOST_MATCHES, $name$route);
                continue;
            }

            if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
                if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) {
                    $this->addTrace('Route matches!', self::ROUTE_MATCHES, $name$route);

                    return $this->allow = $this->allowSchemes = [];
                }

            }

            $hostMatches = [];
            if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex()$this->context->getHost()$hostMatches)) {
                $this->addTrace(sprintf('Host "%s" does not match the requirement ("%s")', $this->context->getHost()$route->getHost()), self::ROUTE_ALMOST_MATCHES, $name$route);
                continue;
            }

            $attributes = $this->getAttributes($route$namearray_replace($matches$hostMatches));

            $status = $this->handleRouteRequirements($pathinfo$name$route$attributes);

            if (self::REQUIREMENT_MISMATCH === $status[0]) {
                $this->addTrace(sprintf('Condition "%s" does not evaluate to "true"', $route->getCondition()), self::ROUTE_ALMOST_MATCHES, $name$route);
                continue;
            }

            if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
                if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) {
                    $this->addTrace('Route matches!', self::ROUTE_MATCHES, $name$route);

                    return $this->allow = $this->allowSchemes = [];
                }


        if (!in_array($method$requiredMethods)) {
          $this->allow = array_merge($this->allow, $requiredMethods);
          $routes->remove($name);
          continue;
        }
      }

      $attributes = $this->getAttributes($route$namearray_replace($matches$hostMatches));

      $status = $this->handleRouteRequirements($pathinfo$name$route$attributes);

      if (self::ROUTE_MATCH === $status[0]) {
        return $status[1];
      }

      if (self::REQUIREMENT_MISMATCH === $status[0]) {
        $routes->remove($name);
        continue;
      }

      return $attributes;
    }
Home | Imprint | This part of the site doesn't use cookies.