Ejemplo n.º 1
0
 /**
  * @return string
  * @throws NotExistsException
  */
 public function getController()
 {
     if (!trim($this->getControllerAsString())) {
         $this->controller = $this->routes->getController('default');
     }
     $controller = $this->buildController($this->getControllerAsString());
     if (!class_exists($controller)) {
         if (substr($controller, -1) !== '\\') {
             $controller = preg_replace('/.*/', '', $controller, 1);
         }
         if (!class_exists($controller)) {
             throw new NotExistsException('Controller ' . $this->getControllerAsString() . ' does not exist');
         }
     }
     return $controller;
 }
Ejemplo n.º 2
0
 public function testGetController()
 {
     $this->assertSame('testController', $this->routes->getController('test'));
 }