/** * Test if the path supplied meets the Route requirements * * @param string $path The path from the URI * @param string $method The HTTP method * @return boolean */ public function testPath($path, $method) { if (empty($this->httpMethod) || in_array($method, $this->httpMethod)) { // Remove trailing slash if (strlen($path) > 1 && substr($path, -1) === '/') { $path = substr($path, 0, -1); } // Path without extention $extlessPath = $this->stripPathExtention($path); // Exact if (strcasecmp($this->getPath(), $path) === 0 || strcasecmp($this->getPath(), $extlessPath) === 0) { return true; } // Regex match if (Params::match($this->getPath(), $path) || Params::match($this->getPath(), $extlessPath)) { return true; } } return false; }
public function __toString() { return Params::apply($this->value, $this->params); }