getServiceLocator()->getContainer(); } /** * Set Psr7 http request * * @param ServerRequestInterface $request * @return $this */ public function setRequest(ServerRequestInterface $request) { $this->request = $request; return $this; } /** * Set Psr7 http response * * @param ResponseInterface $response * @return $this */ public function setResponse(ResponseInterface $response) { $this->response = $response; return $this; } /** * Get the Psr7 request * * @return ServerRequestInterface */ protected function getPsrRequest() { return $this->request; } /** * Get the Psr7 response * * @return ResponseInterface */ public function getPsrResponse() { return $this->response; } /** * Set cookie by setting the HTTP response header "set-cookie" * * @param $name * @param null $value * @param null $expire * @param null $domainPath * @param null $https * @param null $httpOnly * @return bool */ protected function setCookie($name, $value = null, $expire = null, $domainPath = null, $https = null, $httpOnly = null) { return setcookie($name, $value, $expire, $domainPath, $https, $httpOnly); } /** * Set content-type by setting the HTTP response header "content-type" * * @param $contentType * @param string $charset * @return $this */ protected function setContentHeader($contentType, $charset = 'UTF-8') { $this->response = $this->getPsrResponse()->withHeader('content-type', $contentType . ';' . $charset); return $this; } }