mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Optimizing the RouteCollection::getRoutes() method
Signed-off-by: Andrey Pyzhikov <5071@mail.ru>
This commit is contained in:
parent
64d315ecc9
commit
2c77ee5da6
@ -452,16 +452,12 @@ class RouteCollection implements RouteCollectionInterface
|
||||
// we might need to do.
|
||||
$this->discoverRoutes();
|
||||
|
||||
$routes = [];
|
||||
$collection = [];
|
||||
$routes = [];
|
||||
|
||||
if (isset($this->routes[$verb])) {
|
||||
// Keep current verb's routes at the beginning, so they're matched
|
||||
// before any of the generic, "add" routes.
|
||||
if (isset($this->routes['*'])) {
|
||||
$extraRules = array_diff_key($this->routes['*'], $this->routes[$verb]);
|
||||
$collection = array_merge($this->routes[$verb], $extraRules);
|
||||
}
|
||||
$collection = $this->routes[$verb] + ($this->routes['*'] ?? []);
|
||||
|
||||
foreach ($collection as $r) {
|
||||
$key = key($r['route']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user