|
@@ 586-595 (lines=10) @@
|
| 583 |
|
} else { // we need to use a regex to match URIs with params |
| 584 |
|
|
| 585 |
|
// route URIs with params provided to callback |
| 586 |
|
foreach ($this->routes as $route => $callback) { |
| 587 |
|
$pattern = '#^'.$route.'$#s'; |
| 588 |
|
$pattern = preg_replace('#\{\S+\}#', '\S+', $pattern); |
| 589 |
|
|
| 590 |
|
if (preg_match($pattern, $URI)) { |
| 591 |
|
$this->currentRoute = $route; |
| 592 |
|
|
| 593 |
|
return $callback; |
| 594 |
|
} |
| 595 |
|
} |
| 596 |
|
|
| 597 |
|
// route URIs with params missing (will attempt to layer on defaults later on in Request class) |
| 598 |
|
foreach ($this->routes as $route => $callback) { |
|
@@ 598-607 (lines=10) @@
|
| 595 |
|
} |
| 596 |
|
|
| 597 |
|
// route URIs with params missing (will attempt to layer on defaults later on in Request class) |
| 598 |
|
foreach ($this->routes as $route => $callback) { |
| 599 |
|
$pattern = '#^'.$route.'$#s'; |
| 600 |
|
$pattern = preg_replace('#\/\{\S+\}#', '\/?', $pattern); |
| 601 |
|
|
| 602 |
|
if (preg_match($pattern, $URI)) { |
| 603 |
|
$this->currentRoute = $route; |
| 604 |
|
|
| 605 |
|
return $callback; |
| 606 |
|
} |
| 607 |
|
} |
| 608 |
|
} |
| 609 |
|
|
| 610 |
|
// if we made it this far then no match was found |