-
-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Router.php #133
Update Router.php #133
Conversation
Added the option to return matching routes rather than directly executing callbacks. // Create Router instance $router = new Bramus\Router\Router(); $router->setReturnRoutes(true); $router->before('GET', '/', function() { echo 'before middleware'; }); // Define routes $router->get('/', function() { echo 'hello'; }); // Run it! $matches = $router->run(); foreach ($matches as $route) { $route['fn'](); }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you swapped $numHandled
for $this->numHandled
, yet on line 330 it's still referring to $numHandled
. Could you change that?
Looking good otherwise, although a test would also be welcome.
Fixed line 330, referring to $this->numHandled
Done! |
this is an awesome feature (I coud just use very well) - looking forward to the moment this gets merged into the master 👍 👍 👍 |
FYI: tests are failing:
It looks like there is an unwanted side-effect when it comes to handling 404's. Also spotted a lost |
Added the option to return matching routes rather than directly executing callbacks.