PHPRouter\Route::__construct PHP 메소드

__construct() 공개 메소드

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

예제 #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);
 }