From e9271cb7ec40526dde4aa09c92003b787ffa25b8 Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Thu, 14 Mar 2024 11:43:35 +0300 Subject: [PATCH] implement RequestEvent --- .../administrator/src/Event/RequestEvent.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 com_oauthserver/administrator/src/Event/RequestEvent.php diff --git a/com_oauthserver/administrator/src/Event/RequestEvent.php b/com_oauthserver/administrator/src/Event/RequestEvent.php new file mode 100644 index 0000000..8199955 --- /dev/null +++ b/com_oauthserver/administrator/src/Event/RequestEvent.php @@ -0,0 +1,30 @@ + + * @license MIT; see LICENSE.txt + **/ + +namespace Webmasterskaya\Component\OauthServer\Administrator\Event; + +use Psr\Http\Message\ServerRequestInterface; + +class RequestEvent extends AbstractImmutableEvent +{ + public function __construct(string $name, array $arguments = []) + { + if (!array_key_exists('request', $arguments)) + { + throw new \BadMethodCallException("Argument 'request' is required for event $name"); + } + + parent::__construct($name, ['request' => $arguments['request']]); + } + + protected function onSetRequest(ServerRequestInterface $request): ServerRequestInterface + { + return $request; + } +}