Respect/Rest — pull request #63 by nickl- (2012-06-25 10:16:45+00:00)
Title: Add RouteInspector Routine Interface.

Have a look and merge if you also think this is cool.

I want to use the information to add [json-home](http://pretty-rfc.herokuapp.com/draft-nottingham-json-home) capabilities so need the Route information.

The documentation update:

### Your Own Routines

Routines are classes in the Respect\Rest\Routines namespace, but you can add your
own routines by instance using:
```php
get('/greetings', 'Hello World')->appendRoutine(new MyRoutine);
```

In the sample above, `MyRoutine` is a user provided routine declared as a class and
appended to the router. Custom routines have the option of several different interfaces
which can be implemented:

* IgnorableFileExtension - Instructs the router to ignore the file extension in requests
* ParamSynced - Syncs parameters with the route function/method.
* ProxyableBy - Instructs the router to run method `by()` before the route.
* ProxyableThrough - Instructs the router to run method `through()` after the route.
* ProxyableWhen - Instructs the router to run method `when()` to validate the route match.
* RouteInspector - Receives information about all the configured routes as well as the active route, method, all methods and currently selected uri from Respect\Rest\Router.
* Unique - Makes this routine be replaced, not appended, if more than one is declared for
the same type.

You can use any combination of the above but also need to implement the Routinable interface.

Example of a custom routine:
```php
route_patterns[$route->pattern] = $route->method;
}

public function through(Request $request, $params) {
return call_user_func_array(function ($routeInfo) {
return function ($data) use ($routeInfo) {
$html = new Html($data);
$html['table'] = $routeInfo->route_patterns;
return $html->render();
};
}, array($this));
}
}
```

Assuming there's a \ in the $data that we can fill with the array that we just collected. Feel free to check out [Respect/Template](/Respect/Template) for more information about our pure HTML driven template engine.