PHPRouter\Route::__construct PHP Method

__construct() public method

public __construct ( $resource, array $config )
$resource
$config array
    public function __construct($resource, array $config)
    {
        $this->url = $resource;
        $this->config = $config;
        $this->methods = isset($config['methods']) ? (array) $config['methods'] : array();
        $this->target = isset($config['target']) ? $config['target'] : null;
        $this->name = isset($config['name']) ? $config['name'] : null;
    }

Usage Example

Example #1
0
 function __construct($resource, array $config)
 {
     $controller = explode('::', $config['_controller']);
     $this->controller = $controller[0];
     if (!isset($controller[1])) {
         throw new Exception('Не определён экшн');
     }
     $this->bundle = $config['bundle'];
     $this->action = $controller[1];
     $this->controllerClass = $config['namespace'] . $this->controller;
     $config['_controller'] = $config['namespace'] . $config['_controller'];
     parent::__construct($resource, $config);
 }