fabpot/Silex — pull request #804 by fabpot (2013-10-11 10:13:17+00:00)
Title: added a way to delay the attachment of a controller to a route

There are several ideas behind this PR. It's mostly about consistency by being able to decouple the setting of a controller from the match call. The old way still works of course.

It is more consistent as everything can now be done via method calls and the fact that the controller is the second argument makes things uglier, especially when the code in the controller is large.

As an added bonus, it helps when indenting the code (currently, I always wonder how to indent my code as it's not obvious). Last, but not the least, being able to put the code last also makes things more readable.

Current:

```
$app->get('/foo', function ($id) {
// ...
})
->bind('home')
->assert('id', '\d+')
;
```

Now:

```
$app
->get('/foo')
->bind('home')
->assert('id', '\d+')
->run(function ($id) {
// ...
})
;
```