Esempio n. 1
0
 function resolve(Request $request)
 {
     if (!$this->actions || !isset($this->actions[$request->method()])) {
         return;
     }
     $uri = $request->uri();
     $actions = $this->actions[$request->method()];
     foreach ($actions as $route => $action) {
         if ($this->compiler->checkSymbol($route)) {
             $pattern = $this->compiler->compile($route);
             if (preg_match($pattern, $uri, $paths)) {
                 foreach ($paths as $name => $value) {
                     is_string($name) && !isset($request[$name]) && ($request[$name] = $value);
                 }
                 return $action;
             }
         } else {
             if ($route == $request->uri()) {
                 return $action;
             }
         }
     }
 }
Esempio n. 2
0
 public function matches(Request $request)
 {
     return isset($this->indexes[$request->method()]) ? $this->indexes[$request->method()] : [];
 }