/** * @return boolean * @param string $url */ public function match($url) { $domain = $this->getSubDomain(); $matches = array(); if (1 !== preg_match($this->domainPattern, $domain, $matches)) { return false; } if (null == $this->pattern) { $this->matches = $matches; return true; } $result = parent::match($url); if ($result) { $this->matches = array_merge($matches, $this->matches); } return $result; }
public function add($pattern, $controller = 'index', $action = 'index') { $this->addRoute(Nano_Route::create($pattern, $controller, $action)); return $this; }
/** * @return void * @param Nano_Route $route */ protected function setUpController(Nano_Route $route) { if (null === $this->action) { $this->action = $route->action(); } if (null === $this->controller) { $this->controller = $route->controller(); } }
/** * @return string * @param string $controller * @param string $action */ protected function runAction($controller, $action) { return $this->dispatcher->clean()->run(Nano_Route::create('', $controller, $action)); }
public function testVithVariables() { $result = $this->dispatcher->run(Nano_Route::create('', 'test', 'testvar')); $this->assertEquals('Some title. 01=foo.03=bar.', $result); }
public function testGetController() { $c = $this->dispatcher->getController(Nano_Route::create('', 'test', 'test')); $this->assertType('Nano_C', $c); $this->assertType('TestController', $c); }