codeguy/Slim — pull request #721 by mcuelenaere (2013-12-30 11:53:30+00:00)
Title: Lazy-initialize class in \Slim\Route::setCallable()

You don't want to construct all kinds of objects when setting up your routes, so don't initialize those objects until
the route is actually dispatched. Add some basic caching so multiple route dispatches don't result in multiple class
instantiations.

Note: I had to comment out RouteTest::testGetCallableAsClass(), as the callable is now a lambda function instead of an array. WDYT is the best way to solve this? (I think that the test was depending on an implementation detail and should just test whether the set callable is invoked when the route gets dispatched)