codeguy/Slim — pull request #507 by al-the-x (2013-04-17 04:23:39+00:00)
Title: Wouldn't it be nice if class dependencies were (somewhat) configurable?

Then I wouldn't have to subclass `\Slim\Slim`, `\Slim\Router`, and `\Slim\Route` just to change some behavior in `\Slim\Route`...! I could _only_ subclass `\Slim\Route` and inform `\Slim\Router` of the dependency change, e.g.

```php
methods ) return true;

return parent::supportsHttpMethod($method);
}
}

\Slim\Router::$CLASS_ROUTE = 'CustomRoute';

$app = new \Slim\Slim();

// Route "/some/route" for _any_ HTTP method...
$app->map('/some/route', function(){
echo 'Do Something Awesome';
});

$app->run();
```

I thought about using `\Slim\Slim::config()` but not all classes in the package receive the instance of `\Slim\Slim` to call `config()` on, so I thought better to encapsulate dependencies with static variables acting as psuedo-constants.

* PRO: Each class is responsible for its own dependencies.
* CON: The dependency can only be overridden for the entire class.

Discussion?