FOF30\Factory\SwitchFactory::controller PHP Method

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
    public function controller($viewName, array $config = array())
    {
        try {
            return parent::controller($viewName, $config);
        } catch (ControllerNotFound $e) {
        }
        $controllerClass = $this->container->getNamespacePrefix('inverse') . 'Controller\\' . ucfirst($viewName);
        try {
            return $this->createController($controllerClass, $config);
        } catch (ControllerNotFound $e) {
        }
        $controllerClass = $this->container->getNamespacePrefix('inverse') . 'Controller\\' . ucfirst($this->container->inflector->singularize($viewName));
        return $this->createController($controllerClass, $config);
    }

Usage Example

コード例 #1
0
ファイル: SwitchFactoryTest.php プロジェクト: Joal01/fof
 /**
  * @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'));
 }
All Usage Examples Of FOF30\Factory\SwitchFactory::controller