Esempio n. 1
0
 public function matches(Request $request)
 {
     $uri = $request->uri();
     $indexes = [];
     foreach ($this->indexes as $prefix => $index) {
         if (strpos($uri, $prefix) === 0) {
             $indexes += $index;
         }
     }
     return $indexes;
 }
Esempio n. 2
0
 public function matches(Request $request, array $filtered)
 {
     $uri = $request->uri();
     foreach (array_intersect_key($this->indexes, $filtered) as $i => $pattern) {
         if (preg_match($pattern, $uri, $paths)) {
             foreach ($paths as $name => $value) {
                 is_string($name) && !isset($request[$name]) && ($request[$name] = $value);
             }
             return [$i => 1];
         }
     }
     return [];
 }
Esempio n. 3
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. 4
0
 public function matches(Request $request)
 {
     return $this->indexes[$request->isAjax()];
 }
Esempio n. 5
0
 public function matches(Request $request)
 {
     return isset($this->indexes[$request->uri()]) ? $this->indexes[$request->uri()] : [];
 }