vlucas/bulletphp — pull request #9 by jacobwalker0814 (2013-03-26 19:30:21+00:00)
Title: Register response content converters

Add mechanism to allow for automatic conversion of response content and
content type based on user defined test conditions.

I want to do this so I can do something like the following in my setup:
```php
$app->registerContentConverter(
function($content) {
return $content instanceof Hal;
},
function($content) {
return $content->asJson();
},
'application/hal+json'
);
```
And in my routes I can do this:
```php
$app->path('/', function($request) use($app) {
$hal = new Hal('/');
// snip
return $hal;
});
````

The default behavior of converting Arrays to JSON has been preserved by a call to `registerContentConverter` in `\Bullet\App::__construct`