Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/lookup-server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'server/vendor/slim/slim/Slim/Handlers/NotFound.php')
-rw-r--r--server/vendor/slim/slim/Slim/Handlers/NotFound.php126
1 files changed, 0 insertions, 126 deletions
diff --git a/server/vendor/slim/slim/Slim/Handlers/NotFound.php b/server/vendor/slim/slim/Slim/Handlers/NotFound.php
deleted file mode 100644
index d4a9dec..0000000
--- a/server/vendor/slim/slim/Slim/Handlers/NotFound.php
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-/**
- * Slim Framework (https://slimframework.com)
- *
- * @link https://github.com/slimphp/Slim
- * @copyright Copyright (c) 2011-2017 Josh Lockhart
- * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License)
- */
-namespace Slim\Handlers;
-
-use Psr\Http\Message\ServerRequestInterface;
-use Psr\Http\Message\ResponseInterface;
-use Slim\Http\Body;
-use UnexpectedValueException;
-
-/**
- * Default Slim application not found handler.
- *
- * It outputs a simple message in either JSON, XML or HTML based on the
- * Accept header.
- */
-class NotFound extends AbstractHandler
-{
- /**
- * Invoke not found handler
- *
- * @param ServerRequestInterface $request The most recent Request object
- * @param ResponseInterface $response The most recent Response object
- *
- * @return ResponseInterface
- * @throws UnexpectedValueException
- */
- public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
- {
- $contentType = $this->determineContentType($request);
- switch ($contentType) {
- case 'application/json':
- $output = $this->renderJsonNotFoundOutput();
- break;
-
- case 'text/xml':
- case 'application/xml':
- $output = $this->renderXmlNotFoundOutput();
- break;
-
- case 'text/html':
- $output = $this->renderHtmlNotFoundOutput($request);
- break;
-
- default:
- throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType);
- }
-
- $body = new Body(fopen('php://temp', 'r+'));
- $body->write($output);
-
- return $response->withStatus(404)
- ->withHeader('Content-Type', $contentType)
- ->withBody($body);
- }
-
- /**
- * Return a response for application/json content not found
- *
- * @return ResponseInterface
- */
- protected function renderJsonNotFoundOutput()
- {
- return '{"message":"Not found"}';
- }
-
- /**
- * Return a response for xml content not found
- *
- * @return ResponseInterface
- */
- protected function renderXmlNotFoundOutput()
- {
- return '<root><message>Not found</message></root>';
- }
-
- /**
- * Return a response for text/html content not found
- *
- * @param ServerRequestInterface $request The most recent Request object
- *
- * @return ResponseInterface
- */
- protected function renderHtmlNotFoundOutput(ServerRequestInterface $request)
- {
- $homeUrl = (string)($request->getUri()->withPath('')->withQuery('')->withFragment(''));
- return <<<END
-<html>
- <head>
- <title>Page Not Found</title>
- <style>
- body{
- margin:0;
- padding:30px;
- font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;
- }
- h1{
- margin:0;
- font-size:48px;
- font-weight:normal;
- line-height:48px;
- }
- strong{
- display:inline-block;
- width:65px;
- }
- </style>
- </head>
- <body>
- <h1>Page Not Found</h1>
- <p>
- The page you are looking for could not be found. Check the address bar
- to ensure your URL is spelled correctly. If all else fails, you can
- visit our home page at the link below.
- </p>
- <a href='$homeUrl'>Visit the Home Page</a>
- </body>
-</html>
-END;
- }
-}