From 3ece3ca9765a9fc88dbb83aecb154de66ed29190 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Mon, 26 Jun 2017 23:28:41 +0200 Subject: [PATCH] Move events to Flarum\Api namespace --- src/Api/Controller/AbstractSerializeController.php | 8 ++++---- .../Event/Serializing.php} | 6 +++--- .../Event/WillGetData.php} | 4 ++-- .../Event/WillSerializeData.php} | 4 ++-- src/Api/Serializer/AbstractSerializer.php | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) rename src/{Event/PrepareApiAttributes.php => Api/Event/Serializing.php} (92%) rename src/{Event/ConfigureApiController.php => Api/Event/WillGetData.php} (98%) rename src/{Event/PrepareApiData.php => Api/Event/WillSerializeData.php} (96%) diff --git a/src/Api/Controller/AbstractSerializeController.php b/src/Api/Controller/AbstractSerializeController.php index 5bcdfb274..a7ea98986 100644 --- a/src/Api/Controller/AbstractSerializeController.php +++ b/src/Api/Controller/AbstractSerializeController.php @@ -11,9 +11,9 @@ namespace Flarum\Api\Controller; +use Flarum\Api\Event\WillGetData; +use Flarum\Api\Event\WillSerializeData; use Flarum\Api\JsonApiResponse; -use Flarum\Event\ConfigureApiController; -use Flarum\Event\PrepareApiData; use Flarum\Http\Controller\ControllerInterface; use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Events\Dispatcher; @@ -91,13 +91,13 @@ abstract class AbstractSerializeController implements ControllerInterface $document = new Document; static::$events->fire( - new ConfigureApiController($this) + new WillGetData($this) ); $data = $this->data($request, $document); static::$events->fire( - new PrepareApiData($this, $data, $request, $document) + new WillSerializeData($this, $data, $request, $document) ); $serializer = static::$container->make($this->serializer); diff --git a/src/Event/PrepareApiAttributes.php b/src/Api/Event/Serializing.php similarity index 92% rename from src/Event/PrepareApiAttributes.php rename to src/Api/Event/Serializing.php index c97ad794e..d84c9c1fe 100644 --- a/src/Event/PrepareApiAttributes.php +++ b/src/Api/Event/Serializing.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Api\Event; use DateTime; use Flarum\Api\Serializer\AbstractSerializer; @@ -17,10 +17,10 @@ use Flarum\Api\Serializer\AbstractSerializer; /** * Prepare API attributes. * - * This event is fired when a serialize is constructing an array of resource + * This event is fired when a serializer is constructing an array of resource * attributes for API output. */ -class PrepareApiAttributes +class Serializing { /** * The class doing the serializing. diff --git a/src/Event/ConfigureApiController.php b/src/Api/Event/WillGetData.php similarity index 98% rename from src/Event/ConfigureApiController.php rename to src/Api/Event/WillGetData.php index 974944674..790c546b0 100644 --- a/src/Event/ConfigureApiController.php +++ b/src/Api/Event/WillGetData.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Api\Event; use Flarum\Api\Controller\AbstractSerializeController; -class ConfigureApiController +class WillGetData { /** * @var AbstractSerializeController diff --git a/src/Event/PrepareApiData.php b/src/Api/Event/WillSerializeData.php similarity index 96% rename from src/Event/PrepareApiData.php rename to src/Api/Event/WillSerializeData.php index 6d9b8f547..700bb9ee6 100644 --- a/src/Event/PrepareApiData.php +++ b/src/Api/Event/WillSerializeData.php @@ -9,13 +9,13 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Api\Event; use Flarum\Api\Controller\AbstractSerializeController; use Psr\Http\Message\ServerRequestInterface; use Tobscure\JsonApi\Document; -class PrepareApiData +class WillSerializeData { /** * @var AbstractSerializeController diff --git a/src/Api/Serializer/AbstractSerializer.php b/src/Api/Serializer/AbstractSerializer.php index a11c9e28a..279c976a5 100644 --- a/src/Api/Serializer/AbstractSerializer.php +++ b/src/Api/Serializer/AbstractSerializer.php @@ -13,8 +13,8 @@ namespace Flarum\Api\Serializer; use Closure; use DateTime; +use Flarum\Api\Event\Serializing; use Flarum\Event\GetApiRelationship; -use Flarum\Event\PrepareApiAttributes; use Flarum\User\User; use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Events\Dispatcher; @@ -71,7 +71,7 @@ abstract class AbstractSerializer extends BaseAbstractSerializer $attributes = $this->getDefaultAttributes($model); static::$dispatcher->fire( - new PrepareApiAttributes($this, $model, $attributes) + new Serializing($this, $model, $attributes) ); return $attributes;