controller() public method

Create a new Controller object
public controller ( string $viewName, array $config = [] ) : Controller
$viewName string The name of the view we're getting a Controller for.
$config array Optional MVC configuration values for the Controller object.
return FOF30\Controller\Controller
Exemplo n.º 1
0
 /**
  * @group           SwitchFactory
  * @covers          FOF30\Factory\SwitchFactory::controller
  * @dataProvider    SwitchFactoryDataprovider::getTestController
  */
 public function testController($test, $check)
 {
     $msg = 'SwitchFactory::controller %s - Case: ' . $check['case'];
     $platform = static::$container->platform;
     $platform::$isAdmin = $test['backend'];
     $factory = new SwitchFactory(static::$container);
     $result = $factory->controller($test['view']);
     $this->assertEquals($check['result'], get_class($result), sprintf($msg, 'Returned the wrong result'));
 }
Exemplo n.º 2
0
 /**
  * Create a new Controller object
  *
  * @param   string  $viewName  The name of the view we're getting a Controller for.
  * @param   array   $config    Optional MVC configuration values for the Controller object.
  *
  * @return  Controller
  */
 public function controller($viewName, array $config = array())
 {
     try {
         return parent::controller($viewName, $config);
     } catch (ControllerNotFound $e) {
         $magic = new Magic\ControllerFactory($this->container);
         return $magic->make($viewName, $config);
     }
 }
Exemplo n.º 3
0
 /**
  * Create a new Controller object
  *
  * @param   string  $viewName  The name of the view we're getting a Controller for.
  * @param   array   $config    Optional MVC configuration values for the Controller object.
  *
  * @return  Controller
  */
 public function controller($viewName, array $config = array())
 {
     try {
         return parent::controller($viewName, $config);
     } catch (ControllerNotFound $e) {
         $magic = new Magic\ControllerFactory($this->container);
         // Let's pass the section override (if any)
         $magic->setSection($this->getSection());
         return $magic->make($viewName, $config);
     }
 }