/** * GET/POST/PUT/DELETE запросы к маршруту * * @param string $path * @param Closure $action * @param string $filter * @return boolean */ protected function any_action($path, Closure $action, $filter = null) { if (static::$found) { return false; } $path = $this->route_patterns($path); if (preg_match("#^" . $path . "\$#", static::$path, $match)) { if (!is_null($filter)) { $filters = $this->filters_result($filter); if (!array_all(true, $filters)) { return false; } } $params = $this->params($action, $match); static::$action = $action; static::$match = $params; static::$found = true; return true; } return false; }
/** * Static function */ public static function test($expr, $params = array(), $config = array()) { $matcher = new static($params, $config); return $matcher->match($expr); }