Example #1
0
 /**
  * matchOptions
  *
  * @param Route  $route
  * @param string $method
  * @param array  $options
  *
  * @return  bool
  */
 protected function matchOptions(Route $route, $method, $options)
 {
     $options = $route->prepareOptions($options);
     // Match methods
     $this->checkType('method', $method, 'string');
     $allowMethods = $route->getAllowMethods();
     if ($allowMethods && !in_array(strtoupper($method), $allowMethods)) {
         return false;
     }
     // Match Host
     $this->checkType('host', $options['host'], 'string');
     $host = $route->getHost();
     if ($host && $host != strtolower($options['host'])) {
         return false;
     }
     // Match schemes
     $this->checkType('scheme', $options['scheme'], 'string');
     $scheme = $route->getScheme();
     if ($scheme && $scheme != strtolower($options['scheme'])) {
         return false;
     }
     $port = $route->getPort();
     // Match port
     if (!$route->getSSL() && $port && $port != $options['port']) {
         return false;
     }
     if ($route->getSSL() && $port && $port != $options['port']) {
         return false;
     }
     return true;
 }