/** * {@inheritdoc} */ public function createErrorResponseByException(\Exception $ex = null) { //TODO - handle more content types if (null !== $ex && $ex instanceof HttpExceptionInterface) { $statusCode = $ex->getStatusCode(); $headers = (array) $ex->getHeaders(); } else { $statusCode = 500; $headers = array('Content-Type' => array('text/html; charset=UTF-8'), 'Cache-Control' => array('max-age=0', 'must-revalidate', 'no-cache', 'no-store', 'private')); } return $this->messageFactory->createResponse($this->errorPageLoader->loadContentByStatusCode($statusCode), $statusCode, $headers); }
/** * @param ReactRequest $reactRequest * * @return array */ private function transformUpladedFiles(ReactRequest $reactRequest) { $factory = function (array $fileInfo) use(&$factory) { $files = array(); foreach ($fileInfo as $name => &$attr) { if (is_array($attr) && isset($attr['stream'])) { $files[$name] = $this->psr7Factory->createUploadedFile($attr['stream'], $attr['size'], $attr['error'], $attr['name'], $attr['type']); } elseif (is_array($attr)) { $files[$name] = $factory($attr); } else { throw new \InvalidArgumentException('Invalid value in files specification'); } } return $files; }; return $factory($reactRequest->getFiles()); }