コード例 #1
0
ファイル: Subdomain.php プロジェクト: studio-v/nano
 /**
  * @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;
 }
コード例 #2
0
ファイル: Routes.php プロジェクト: studio-v/nano
 public function add($pattern, $controller = 'index', $action = 'index')
 {
     $this->addRoute(Nano_Route::create($pattern, $controller, $action));
     return $this;
 }
コード例 #3
0
ファイル: Dispatcher.php プロジェクト: studio-v/nano
 /**
  * @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();
     }
 }
コード例 #4
0
ファイル: ControllerTestCase.php プロジェクト: studio-v/nano
 /**
  * @return string
  * @param string $controller
  * @param string $action
  */
 protected function runAction($controller, $action)
 {
     return $this->dispatcher->clean()->run(Nano_Route::create('', $controller, $action));
 }
コード例 #5
0
ファイル: RenderTest.php プロジェクト: studio-v/nano
 public function testVithVariables()
 {
     $result = $this->dispatcher->run(Nano_Route::create('', 'test', 'testvar'));
     $this->assertEquals('Some title. 01=foo.03=bar.', $result);
 }
コード例 #6
0
ファイル: DispatcherTest.php プロジェクト: studio-v/nano
 public function testGetController()
 {
     $c = $this->dispatcher->getController(Nano_Route::create('', 'test', 'test'));
     $this->assertType('Nano_C', $c);
     $this->assertType('TestController', $c);
 }