diff options
Diffstat (limited to 'server/vendor/slim/slim/Slim/Handlers')
8 files changed, 0 insertions, 945 deletions
diff --git a/server/vendor/slim/slim/Slim/Handlers/AbstractError.php b/server/vendor/slim/slim/Slim/Handlers/AbstractError.php deleted file mode 100644 index 42f8dde..0000000 --- a/server/vendor/slim/slim/Slim/Handlers/AbstractError.php +++ /dev/null @@ -1,99 +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; - -/** - * Abstract Slim application error handler - */ -abstract class AbstractError extends AbstractHandler -{ - /** - * @var bool - */ - protected $displayErrorDetails; - - /** - * Constructor - * - * @param bool $displayErrorDetails Set to true to display full details - */ - public function __construct($displayErrorDetails = false) - { - $this->displayErrorDetails = (bool) $displayErrorDetails; - } - - /** - * Write to the error log if displayErrorDetails is false - * - * @param \Exception|\Throwable $throwable - * - * @return void - */ - protected function writeToErrorLog($throwable) - { - if ($this->displayErrorDetails) { - return; - } - - $message = 'Slim Application Error:' . PHP_EOL; - $message .= $this->renderThrowableAsText($throwable); - while ($throwable = $throwable->getPrevious()) { - $message .= PHP_EOL . 'Previous error:' . PHP_EOL; - $message .= $this->renderThrowableAsText($throwable); - } - - $message .= PHP_EOL . 'View in rendered output by enabling the "displayErrorDetails" setting.' . PHP_EOL; - - $this->logError($message); - } - - /** - * Render error as Text. - * - * @param \Exception|\Throwable $throwable - * - * @return string - */ - protected function renderThrowableAsText($throwable) - { - $text = sprintf('Type: %s' . PHP_EOL, get_class($throwable)); - - if ($code = $throwable->getCode()) { - $text .= sprintf('Code: %s' . PHP_EOL, $code); - } - - if ($message = $throwable->getMessage()) { - $text .= sprintf('Message: %s' . PHP_EOL, htmlentities($message)); - } - - if ($file = $throwable->getFile()) { - $text .= sprintf('File: %s' . PHP_EOL, $file); - } - - if ($line = $throwable->getLine()) { - $text .= sprintf('Line: %s' . PHP_EOL, $line); - } - - if ($trace = $throwable->getTraceAsString()) { - $text .= sprintf('Trace: %s', $trace); - } - - return $text; - } - - /** - * Wraps the error_log function so that this can be easily tested - * - * @param $message - */ - protected function logError($message) - { - error_log($message); - } -} diff --git a/server/vendor/slim/slim/Slim/Handlers/AbstractHandler.php b/server/vendor/slim/slim/Slim/Handlers/AbstractHandler.php deleted file mode 100644 index b166a15..0000000 --- a/server/vendor/slim/slim/Slim/Handlers/AbstractHandler.php +++ /dev/null @@ -1,59 +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; - -/** - * Abstract Slim application handler - */ -abstract class AbstractHandler -{ - /** - * Known handled content types - * - * @var array - */ - protected $knownContentTypes = [ - 'application/json', - 'application/xml', - 'text/xml', - 'text/html', - ]; - - /** - * Determine which content type we know about is wanted using Accept header - * - * Note: This method is a bare-bones implementation designed specifically for - * Slim's error handling requirements. Consider a fully-feature solution such - * as willdurand/negotiation for any other situation. - * - * @param ServerRequestInterface $request - * @return string - */ - protected function determineContentType(ServerRequestInterface $request) - { - $acceptHeader = $request->getHeaderLine('Accept'); - $selectedContentTypes = array_intersect(explode(',', $acceptHeader), $this->knownContentTypes); - - if (count($selectedContentTypes)) { - return current($selectedContentTypes); - } - - // handle +json and +xml specially - if (preg_match('/\+(json|xml)/', $acceptHeader, $matches)) { - $mediaType = 'application/' . $matches[1]; - if (in_array($mediaType, $this->knownContentTypes)) { - return $mediaType; - } - } - - return 'text/html'; - } -} diff --git a/server/vendor/slim/slim/Slim/Handlers/Error.php b/server/vendor/slim/slim/Slim/Handlers/Error.php deleted file mode 100644 index dd0bc8d..0000000 --- a/server/vendor/slim/slim/Slim/Handlers/Error.php +++ /dev/null @@ -1,224 +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\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; -use Slim\Http\Body; -use UnexpectedValueException; - -/** - * Default Slim application error handler - * - * It outputs the error message and diagnostic information in either JSON, XML, - * or HTML based on the Accept header. - */ -class Error extends AbstractError -{ - /** - * Invoke error handler - * - * @param ServerRequestInterface $request The most recent Request object - * @param ResponseInterface $response The most recent Response object - * @param \Exception $exception The caught Exception object - * - * @return ResponseInterface - * @throws UnexpectedValueException - */ - public function __invoke(ServerRequestInterface $request, ResponseInterface $response, \Exception $exception) - { - $contentType = $this->determineContentType($request); - switch ($contentType) { - case 'application/json': - $output = $this->renderJsonErrorMessage($exception); - break; - - case 'text/xml': - case 'application/xml': - $output = $this->renderXmlErrorMessage($exception); - break; - - case 'text/html': - $output = $this->renderHtmlErrorMessage($exception); - break; - - default: - throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType); - } - - $this->writeToErrorLog($exception); - - $body = new Body(fopen('php://temp', 'r+')); - $body->write($output); - - return $response - ->withStatus(500) - ->withHeader('Content-type', $contentType) - ->withBody($body); - } - - /** - * Render HTML error page - * - * @param \Exception $exception - * - * @return string - */ - protected function renderHtmlErrorMessage(\Exception $exception) - { - $title = 'Slim Application Error'; - - if ($this->displayErrorDetails) { - $html = '<p>The application could not run because of the following error:</p>'; - $html .= '<h2>Details</h2>'; - $html .= $this->renderHtmlException($exception); - - while ($exception = $exception->getPrevious()) { - $html .= '<h2>Previous exception</h2>'; - $html .= $this->renderHtmlExceptionOrError($exception); - } - } else { - $html = '<p>A website error has occurred. Sorry for the temporary inconvenience.</p>'; - } - - $output = sprintf( - "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" . - "<title>%s</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>%s</h1>%s</body></html>", - $title, - $title, - $html - ); - - return $output; - } - - /** - * Render exception as HTML. - * - * Provided for backwards compatibility; use renderHtmlExceptionOrError(). - * - * @param \Exception $exception - * - * @return string - */ - protected function renderHtmlException(\Exception $exception) - { - return $this->renderHtmlExceptionOrError($exception); - } - - /** - * Render exception or error as HTML. - * - * @param \Exception|\Error $exception - * - * @return string - */ - protected function renderHtmlExceptionOrError($exception) - { - if (!$exception instanceof \Exception && !$exception instanceof \Error) { - throw new \RuntimeException("Unexpected type. Expected Exception or Error."); - } - - $html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception)); - - if (($code = $exception->getCode())) { - $html .= sprintf('<div><strong>Code:</strong> %s</div>', $code); - } - - if (($message = $exception->getMessage())) { - $html .= sprintf('<div><strong>Message:</strong> %s</div>', htmlentities($message)); - } - - if (($file = $exception->getFile())) { - $html .= sprintf('<div><strong>File:</strong> %s</div>', $file); - } - - if (($line = $exception->getLine())) { - $html .= sprintf('<div><strong>Line:</strong> %s</div>', $line); - } - - if (($trace = $exception->getTraceAsString())) { - $html .= '<h2>Trace</h2>'; - $html .= sprintf('<pre>%s</pre>', htmlentities($trace)); - } - - return $html; - } - - /** - * Render JSON error - * - * @param \Exception $exception - * - * @return string - */ - protected function renderJsonErrorMessage(\Exception $exception) - { - $error = [ - 'message' => 'Slim Application Error', - ]; - - if ($this->displayErrorDetails) { - $error['exception'] = []; - - do { - $error['exception'][] = [ - 'type' => get_class($exception), - 'code' => $exception->getCode(), - 'message' => $exception->getMessage(), - 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - 'trace' => explode("\n", $exception->getTraceAsString()), - ]; - } while ($exception = $exception->getPrevious()); - } - - return json_encode($error, JSON_PRETTY_PRINT); - } - - /** - * Render XML error - * - * @param \Exception $exception - * - * @return string - */ - protected function renderXmlErrorMessage(\Exception $exception) - { - $xml = "<error>\n <message>Slim Application Error</message>\n"; - if ($this->displayErrorDetails) { - do { - $xml .= " <exception>\n"; - $xml .= " <type>" . get_class($exception) . "</type>\n"; - $xml .= " <code>" . $exception->getCode() . "</code>\n"; - $xml .= " <message>" . $this->createCdataSection($exception->getMessage()) . "</message>\n"; - $xml .= " <file>" . $exception->getFile() . "</file>\n"; - $xml .= " <line>" . $exception->getLine() . "</line>\n"; - $xml .= " <trace>" . $this->createCdataSection($exception->getTraceAsString()) . "</trace>\n"; - $xml .= " </exception>\n"; - } while ($exception = $exception->getPrevious()); - } - $xml .= "</error>"; - - return $xml; - } - - /** - * Returns a CDATA section with the given content. - * - * @param string $content - * @return string - */ - private function createCdataSection($content) - { - return sprintf('<![CDATA[%s]]>', str_replace(']]>', ']]]]><![CDATA[>', $content)); - } -} diff --git a/server/vendor/slim/slim/Slim/Handlers/NotAllowed.php b/server/vendor/slim/slim/Slim/Handlers/NotAllowed.php deleted file mode 100644 index 9f382c4..0000000 --- a/server/vendor/slim/slim/Slim/Handlers/NotAllowed.php +++ /dev/null @@ -1,147 +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 allowed handler - * - * It outputs a simple message in either JSON, XML or HTML based on the - * Accept header. - */ -class NotAllowed extends AbstractHandler -{ - /** - * Invoke error handler - * - * @param ServerRequestInterface $request The most recent Request object - * @param ResponseInterface $response The most recent Response object - * @param string[] $methods Allowed HTTP methods - * - * @return ResponseInterface - * @throws UnexpectedValueException - */ - public function __invoke(ServerRequestInterface $request, ResponseInterface $response, array $methods) - { - if ($request->getMethod() === 'OPTIONS') { - $status = 200; - $contentType = 'text/plain'; - $output = $this->renderPlainNotAllowedMessage($methods); - } else { - $status = 405; - $contentType = $this->determineContentType($request); - switch ($contentType) { - case 'application/json': - $output = $this->renderJsonNotAllowedMessage($methods); - break; - - case 'text/xml': - case 'application/xml': - $output = $this->renderXmlNotAllowedMessage($methods); - break; - - case 'text/html': - $output = $this->renderHtmlNotAllowedMessage($methods); - break; - default: - throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType); - } - } - - $body = new Body(fopen('php://temp', 'r+')); - $body->write($output); - $allow = implode(', ', $methods); - - return $response - ->withStatus($status) - ->withHeader('Content-type', $contentType) - ->withHeader('Allow', $allow) - ->withBody($body); - } - - /** - * Render PLAIN not allowed message - * - * @param array $methods - * @return string - */ - protected function renderPlainNotAllowedMessage($methods) - { - $allow = implode(', ', $methods); - - return 'Allowed methods: ' . $allow; - } - - /** - * Render JSON not allowed message - * - * @param array $methods - * @return string - */ - protected function renderJsonNotAllowedMessage($methods) - { - $allow = implode(', ', $methods); - - return '{"message":"Method not allowed. Must be one of: ' . $allow . '"}'; - } - - /** - * Render XML not allowed message - * - * @param array $methods - * @return string - */ - protected function renderXmlNotAllowedMessage($methods) - { - $allow = implode(', ', $methods); - - return "<root><message>Method not allowed. Must be one of: $allow</message></root>"; - } - - /** - * Render HTML not allowed message - * - * @param array $methods - * @return string - */ - protected function renderHtmlNotAllowedMessage($methods) - { - $allow = implode(', ', $methods); - $output = <<<END -<html> - <head> - <title>Method not allowed</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; - } - </style> - </head> - <body> - <h1>Method not allowed</h1> - <p>Method not allowed. Must be one of: <strong>$allow</strong></p> - </body> -</html> -END; - - return $output; - } -} 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; - } -} diff --git a/server/vendor/slim/slim/Slim/Handlers/PhpError.php b/server/vendor/slim/slim/Slim/Handlers/PhpError.php deleted file mode 100644 index 3ecce30..0000000 --- a/server/vendor/slim/slim/Slim/Handlers/PhpError.php +++ /dev/null @@ -1,205 +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\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; -use Slim\Http\Body; -use UnexpectedValueException; - -/** - * Default Slim application error handler for PHP 7+ Throwables - * - * It outputs the error message and diagnostic information in either JSON, XML, - * or HTML based on the Accept header. - */ -class PhpError extends AbstractError -{ - /** - * Invoke error handler - * - * @param ServerRequestInterface $request The most recent Request object - * @param ResponseInterface $response The most recent Response object - * @param \Throwable $error The caught Throwable object - * - * @return ResponseInterface - * @throws UnexpectedValueException - */ - public function __invoke(ServerRequestInterface $request, ResponseInterface $response, \Throwable $error) - { - $contentType = $this->determineContentType($request); - switch ($contentType) { - case 'application/json': - $output = $this->renderJsonErrorMessage($error); - break; - - case 'text/xml': - case 'application/xml': - $output = $this->renderXmlErrorMessage($error); - break; - - case 'text/html': - $output = $this->renderHtmlErrorMessage($error); - break; - default: - throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType); - } - - $this->writeToErrorLog($error); - - $body = new Body(fopen('php://temp', 'r+')); - $body->write($output); - - return $response - ->withStatus(500) - ->withHeader('Content-type', $contentType) - ->withBody($body); - } - - /** - * Render HTML error page - * - * @param \Throwable $error - * - * @return string - */ - protected function renderHtmlErrorMessage(\Throwable $error) - { - $title = 'Slim Application Error'; - - if ($this->displayErrorDetails) { - $html = '<p>The application could not run because of the following error:</p>'; - $html .= '<h2>Details</h2>'; - $html .= $this->renderHtmlError($error); - - while ($error = $error->getPrevious()) { - $html .= '<h2>Previous error</h2>'; - $html .= $this->renderHtmlError($error); - } - } else { - $html = '<p>A website error has occurred. Sorry for the temporary inconvenience.</p>'; - } - - $output = sprintf( - "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" . - "<title>%s</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>%s</h1>%s</body></html>", - $title, - $title, - $html - ); - - return $output; - } - - /** - * Render error as HTML. - * - * @param \Throwable $error - * - * @return string - */ - protected function renderHtmlError(\Throwable $error) - { - $html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($error)); - - if (($code = $error->getCode())) { - $html .= sprintf('<div><strong>Code:</strong> %s</div>', $code); - } - - if (($message = $error->getMessage())) { - $html .= sprintf('<div><strong>Message:</strong> %s</div>', htmlentities($message)); - } - - if (($file = $error->getFile())) { - $html .= sprintf('<div><strong>File:</strong> %s</div>', $file); - } - - if (($line = $error->getLine())) { - $html .= sprintf('<div><strong>Line:</strong> %s</div>', $line); - } - - if (($trace = $error->getTraceAsString())) { - $html .= '<h2>Trace</h2>'; - $html .= sprintf('<pre>%s</pre>', htmlentities($trace)); - } - - return $html; - } - - /** - * Render JSON error - * - * @param \Throwable $error - * - * @return string - */ - protected function renderJsonErrorMessage(\Throwable $error) - { - $json = [ - 'message' => 'Slim Application Error', - ]; - - if ($this->displayErrorDetails) { - $json['error'] = []; - - do { - $json['error'][] = [ - 'type' => get_class($error), - 'code' => $error->getCode(), - 'message' => $error->getMessage(), - 'file' => $error->getFile(), - 'line' => $error->getLine(), - 'trace' => explode("\n", $error->getTraceAsString()), - ]; - } while ($error = $error->getPrevious()); - } - - return json_encode($json, JSON_PRETTY_PRINT); - } - - /** - * Render XML error - * - * @param \Throwable $error - * - * @return string - */ - protected function renderXmlErrorMessage(\Throwable $error) - { - $xml = "<error>\n <message>Slim Application Error</message>\n"; - if ($this->displayErrorDetails) { - do { - $xml .= " <error>\n"; - $xml .= " <type>" . get_class($error) . "</type>\n"; - $xml .= " <code>" . $error->getCode() . "</code>\n"; - $xml .= " <message>" . $this->createCdataSection($error->getMessage()) . "</message>\n"; - $xml .= " <file>" . $error->getFile() . "</file>\n"; - $xml .= " <line>" . $error->getLine() . "</line>\n"; - $xml .= " <trace>" . $this->createCdataSection($error->getTraceAsString()) . "</trace>\n"; - $xml .= " </error>\n"; - } while ($error = $error->getPrevious()); - } - $xml .= "</error>"; - - return $xml; - } - - /** - * Returns a CDATA section with the given content. - * - * @param string $content - * @return string - */ - private function createCdataSection($content) - { - return sprintf('<![CDATA[%s]]>', str_replace(']]>', ']]]]><![CDATA[>', $content)); - } -} diff --git a/server/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php b/server/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php deleted file mode 100644 index ad99b56..0000000 --- a/server/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php +++ /dev/null @@ -1,43 +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\Strategies; - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; -use Slim\Interfaces\InvocationStrategyInterface; - -/** - * Default route callback strategy with route parameters as an array of arguments. - */ -class RequestResponse implements InvocationStrategyInterface -{ - /** - * Invoke a route callable with request, response, and all route parameters - * as an array of arguments. - * - * @param array|callable $callable - * @param ServerRequestInterface $request - * @param ResponseInterface $response - * @param array $routeArguments - * - * @return mixed - */ - public function __invoke( - callable $callable, - ServerRequestInterface $request, - ResponseInterface $response, - array $routeArguments - ) { - foreach ($routeArguments as $k => $v) { - $request = $request->withAttribute($k, $v); - } - - return call_user_func($callable, $request, $response, $routeArguments); - } -} diff --git a/server/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponseArgs.php b/server/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponseArgs.php deleted file mode 100644 index 739cc7e..0000000 --- a/server/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponseArgs.php +++ /dev/null @@ -1,42 +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\Strategies; - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; -use Slim\Interfaces\InvocationStrategyInterface; - -/** - * Route callback strategy with route parameters as individual arguments. - */ -class RequestResponseArgs implements InvocationStrategyInterface -{ - - /** - * Invoke a route callable with request, response and all route parameters - * as individual arguments. - * - * @param array|callable $callable - * @param ServerRequestInterface $request - * @param ResponseInterface $response - * @param array $routeArguments - * - * @return mixed - */ - public function __invoke( - callable $callable, - ServerRequestInterface $request, - ResponseInterface $response, - array $routeArguments - ) { - array_unshift($routeArguments, $request, $response); - - return call_user_func_array($callable, $routeArguments); - } -} |