function __construct($controller, $action, URL $url = null) { if (is_null($url)) { $url = new URL(); $url->load(); } $this->controller = $controller; $this->action = $action; $this->url = $url; }
function __construct(Request $request, URL $url = null) { if (is_null($url)) { $url = new URL(); $url->load(); // Request убивает двоеточия в URL, поэтому используется $_SERVER['REQUEST_URI'] } $this->setRequest($request); $this->setUrl($url); $this->init(); }
function __construct(URL $url = null, $controllers_path = null) { if (is_null($url)) { $url = new URL(); $url->load(); } if (!is_null($controllers_path)) { $this->setControllersPath($controllers_path); } $this->setURL($url); $this->init(); }
function testConstructor() { $u1 = new URL('one', 'two', 'three'); $u2 = new URL(); $u2->load('one', 'two', 'three'); $this->assertEquals($u2->toString(), $u1->toString(), 'Конструктор и Load'); }