chriso/klein.php — pull request #106 by Rican7 (2013-06-17 05:36:08+00:00)
Title: Feature - Route Match (Dispatch) Control

This Pull Request adds a new feature, allowing a developer to take more control of how the `Klein->dispatch()` method works with route callbacks.

In response to issues/PR's like #89 and #105, I thought it would be an interesting idea to explore the idea of allowing exceptions (and nice alias methods) to allow the control of the dispatch's callback execution.

This PR adds a new `DispatchHaltedException` exception class with constant values aligning with its halt-style, and a `$number_of_skips` property to contain the number of callbacks that should be skipped.

There are also some nice convenient methods in the `Klein` class, such as:
- `skipThis()` - For skipping/stopping the current callback
- `skipNext($num)` - For skipping/stopping the next (or `$num` of) callbacks
- `skipRest()` - For stopping the rest of the callbacks

I wanted to add this as a pull request, instead of immediately merging it, so that followers of the project and developers like @daveroberts and @unstoppablecarl could take a look at the approach and discuss/give feedback on the idea.

So, please let me know what you think, so we can do this right the first time. :+1: