codeguy/Slim — pull request #739 by ciaranmaher (2014-01-29 14:23:02+00:00)
Title: Only instantiate the controller class if the route is requested

Not sure if this is a document error or a bug but according to the [2.40 release notes](https://github.com/codeguy/Slim/releases/tag/2.4.0) the app will instantiate the controller class when the route is requested.

This is not the case, presently the class is instantiated even if the route is not requested.
e.g.
$app->get('/hello/:name', '\Hello:sayHello');
$app->get('/bye/:name', '\GoodBye:sayBye');

If you request `/hello/Josh`, the constructor of both `\Hello` and `\GoodBye` will be triggered.

To get around this issue I've just moved the instantiation of the class from `setCallable` to `getCallable`