Example #1
0
 /**
  * @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;
 }
Example #2
0
 public function add($pattern, $controller = 'index', $action = 'index')
 {
     $this->addRoute(Nano_Route::create($pattern, $controller, $action));
     return $this;
 }
Example #3
0
 /**
  * @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();
     }
 }
Example #4
0
 /**
  * @return string
  * @param string $controller
  * @param string $action
  */
 protected function runAction($controller, $action)
 {
     return $this->dispatcher->clean()->run(Nano_Route::create('', $controller, $action));
 }
Example #5
0
 public function testVithVariables()
 {
     $result = $this->dispatcher->run(Nano_Route::create('', 'test', 'testvar'));
     $this->assertEquals('Some title. 01=foo.03=bar.', $result);
 }
Example #6
0
 public function testGetController()
 {
     $c = $this->dispatcher->getController(Nano_Route::create('', 'test', 'test'));
     $this->assertType('Nano_C', $c);
     $this->assertType('TestController', $c);
 }