/** * Construct router. * * @param \Jivoo\Store\Document $config Optional router configuration * document. */ public function __construct(\Jivoo\Store\Document $config = null) { parent::__construct(); if (isset($config)) { $this->rewrite = $config->get('rewrite', $this->rewrite); } }
/** * Construct SAPI server. * * @param callable|null $handler Optional request handler. Must accept two * parameters, a {@see ServerRequestInterface} object and a * {@see ResponseInterface} object, and return a {@see ResponseInterface} * object. * @param ServerRequestInterface|null $request Optional request to handle. * The default value is created from PHP's superglobals, see * {@see Request::createGlobal}. * @param string $path Cookie default path. * @param string $domain Cookie default domain. */ public function __construct($handler = null, ServerRequestInterface $request = null, $path = '/', $domain = '') { parent::__construct(); if (!isset($handler)) { $handler = function (ServerRequestInterface $request, ResponseInterface $response) { return $response; }; } $this->handler = $handler; if (!isset($request)) { $request = Request::createGlobal(); } $this->request = $request; $this->path = $path; $this->domain = $domain; }