I'm trying to sharpen my programming skills, and I came across a frustrating problem, which is likely to be best explained with an example:
Let's say I create microCMS in PHP. This microSMS has a Router class that is responsible for routing. It also contains the URI and additional parameters that are extracted from it.
class Router{
private $uri;
private $params;
...
public function getRoute(){ ... }
...
public function getParams(){
return $this->params;
}
...
}
I also have a Front Controller to which I am passing a new Router () object. So far, so good, I can access additional options in my Front Controller (via $router->getParams();).
class FrontController{
private $controller;
private $view;
public function __construct(Router $router){
$route = $router->getRoute();
...
$params = $router->getParams();
...
$this->view = new View($route->getModel());
...
}
, . - . , (, URI).
class View{
public function output(){
}
}
, , , , Router static Router::getParams()... , -.
, - Router View. , , - . , , , , . ?
Locator - $serviceLocator->getRouter() . , -, -.
, ? - CMS?