63 lines
1.1 KiB
PHP
63 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Standard RouteHandler
|
|
* Instanziiert den Standard Controller
|
|
* @author Christian Steinle
|
|
* @date 03.08.2016
|
|
*
|
|
* @copyright CS medien- & kommunikationssysteme (http://www.steinle-computer.de)
|
|
*/
|
|
|
|
namespace Route;
|
|
|
|
use Controller\FrontendController;
|
|
|
|
|
|
class FrontendRoute
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $route = '';
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $routeParts = array();
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $request = array();
|
|
|
|
/**
|
|
* @var FrontendController|null
|
|
*/
|
|
protected $controller = null;
|
|
|
|
|
|
/**
|
|
* FrontendRoute constructor.
|
|
* @param string $route
|
|
* @param bool $editable
|
|
* @param array $request
|
|
*/
|
|
public function __construct($route, $editable = false, array $request = array())
|
|
{
|
|
$this->setRoute($route);
|
|
$this->request = $request;
|
|
$this->controller = new FrontendController($this->route, $request);
|
|
$this->controller->setEditable($editable);
|
|
$this->controller->init();
|
|
}
|
|
|
|
|
|
/**
|
|
* @param string $route
|
|
*/
|
|
private function setRoute($route)
|
|
{
|
|
$this->route = trim($route, " \t\n\r\0\x0B/");
|
|
$this->routeParts = explode('/', $this->route);
|
|
}
|
|
} |