FOF30\Dispatcher\Dispatcher::__construct PHP Method

__construct() public method

The $config array can contain the following optional values: defaultView string The view to render if none is specified in $input Do note that $config is passed to the Controller and through it to the Model and View. Please see these classes for more information on the configuration variables they accept.
public __construct ( Container $container, array $config = [] )
$container FOF30\Container\Container
$config array
    public function __construct(Container $container, array $config = array())
    {
        $this->container = $container;
        $this->config = $config;
        if (isset($config['defaultView'])) {
            $this->defaultView = $config['defaultView'];
        }
        // Get the default values for the view and layout names
        $this->view = $this->input->getCmd('view', null);
        $this->layout = $this->input->getCmd('layout', null);
        // Not redundant; you may pass an empty but non-null view which is invalid, so we need the fallback
        if (empty($this->view)) {
            $this->view = $this->defaultView;
            $this->container->input->set('view', $this->view);
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Assigns callback functions to the class, the $methods array should be an associative one, where
  * the keys are the method names, while the values are the closure functions, e.g.
  *
  * array(
  *    'foobar' => function(){ return 'Foobar'; }
  * )
  *
  * @param           $container
  * @param array     $config
  * @param array     $methods
  */
 public function __construct(Container $container, array $config = array(), array $methods = array())
 {
     foreach ($methods as $method => $function) {
         $this->mockedMethods[$method] = $function;
     }
     parent::__construct($container, $config);
 }
All Usage Examples Of FOF30\Dispatcher\Dispatcher::__construct