Move command classes to domain namespaces

They will probably be refactored away at a later stage (when we get
rid of the command bus). Until then, this lets us remove the
Flarum\Core namespace and actually feels quite clean.
This commit is contained in:
Franz Liedke 2017-06-24 15:21:07 +02:00
parent 95dc7e71f4
commit 5b0d0d9f0f
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4
57 changed files with 115 additions and 119 deletions

View File

@ -11,8 +11,8 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\ReadDiscussion;
use Flarum\Core\Command\StartDiscussion;
use Flarum\Discussion\Command\ReadDiscussion;
use Flarum\Discussion\Command\StartDiscussion;
use Flarum\Post\Floodgate;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\CreateGroup;
use Flarum\Group\Command\CreateGroup;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

View File

@ -11,8 +11,8 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\PostReply;
use Flarum\Core\Command\ReadDiscussion;
use Flarum\Discussion\Command\ReadDiscussion;
use Flarum\Post\Command\PostReply;
use Flarum\Post\Floodgate;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\RegisterUser;
use Flarum\User\Command\RegisterUser;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\DeleteAvatar;
use Flarum\User\Command\DeleteAvatar;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\DeleteDiscussion;
use Flarum\Discussion\Command\DeleteDiscussion;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\DeleteGroup;
use Flarum\Group\Command\DeleteGroup;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\DeletePost;
use Flarum\Post\Command\DeletePost;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\DeleteUser;
use Flarum\User\Command\DeleteUser;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\RequestPasswordReset;
use Flarum\User\Command\RequestPasswordReset;
use Flarum\User\UserRepository;
use Flarum\Http\Controller\ControllerInterface;
use Illuminate\Contracts\Bus\Dispatcher;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\ReadAllNotifications;
use Flarum\Notification\Command\ReadAllNotifications;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;

View File

@ -11,8 +11,8 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\EditDiscussion;
use Flarum\Core\Command\ReadDiscussion;
use Flarum\Discussion\Command\EditDiscussion;
use Flarum\Discussion\Command\ReadDiscussion;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Database\Eloquent\Collection;
use Psr\Http\Message\ServerRequestInterface;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\EditGroup;
use Flarum\Group\Command\EditGroup;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\ReadNotification;
use Flarum\Notification\Command\ReadNotification;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\EditPost;
use Flarum\Post\Command\EditPost;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\EditUser;
use Flarum\User\Command\EditUser;
use Flarum\User\Exception\PermissionDeniedException;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;

View File

@ -11,7 +11,7 @@
namespace Flarum\Api\Controller;
use Flarum\Core\Command\UploadAvatar;
use Flarum\User\Command\UploadAvatar;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Discussion\Command;
use Flarum\User\User;

View File

@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Discussion\Command;
use Flarum\Discussion\DiscussionRepository;
use Flarum\Discussion\Event\Deleting;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Discussion\DiscussionRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Discussion\Event\Deleting;
use Illuminate\Contracts\Events\Dispatcher;
class DeleteDiscussionHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Discussion\Command;
use Flarum\User\User;

View File

@ -9,14 +9,13 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Discussion\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Discussion\DiscussionRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Discussion\DiscussionValidator;
use Flarum\Discussion\Event\Saving;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AssertPermissionTrait;
use Illuminate\Contracts\Events\Dispatcher;
class EditDiscussionHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Discussion\Command;
use Flarum\User\User;

View File

@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Discussion\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\Discussion\DiscussionRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Discussion\Event\UserDataSaving;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AssertPermissionTrait;
use Illuminate\Contracts\Events\Dispatcher;
class ReadDiscussionHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Discussion\Command;
use Flarum\User\User;

View File

@ -9,14 +9,14 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Discussion\Command;
use Exception;
use Flarum\User\AssertPermissionTrait;
use Flarum\Discussion\Discussion;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Discussion\DiscussionValidator;
use Flarum\Discussion\Event\Saving;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AssertPermissionTrait;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Contracts\Events\Dispatcher as EventDispatcher;

View File

@ -11,11 +11,11 @@
namespace Flarum\Forum\Controller;
use Flarum\Core\Command\ConfirmEmail;
use Flarum\User\Exception\InvalidConfirmationTokenException;
use Flarum\Foundation\Application;
use Flarum\Http\Controller\ControllerInterface;
use Flarum\Http\SessionAuthenticator;
use Flarum\User\Command\ConfirmEmail;
use Flarum\User\Exception\InvalidConfirmationTokenException;
use Illuminate\Contracts\Bus\Dispatcher;
use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Diactoros\Response\HtmlResponse;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Group\Command;
use Flarum\User\User;

View File

@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Group\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\Group\Group;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Group\GroupValidator;
use Flarum\Group\Event\Saving;
use Flarum\Group\Group;
use Flarum\Group\GroupValidator;
use Flarum\User\AssertPermissionTrait;
use Illuminate\Contracts\Events\Dispatcher;
class CreateGroupHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Group\Command;
use Flarum\User\User;

View File

@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Group\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Group\GroupRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Group\Event\Deleting;
use Flarum\Group\GroupRepository;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Illuminate\Contracts\Events\Dispatcher;
class DeleteGroupHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Group\Command;
use Flarum\User\User;

View File

@ -9,15 +9,15 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Group\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Group\Event\Saving;
use Flarum\Group\Group;
use Flarum\Group\GroupRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Group\GroupValidator;
use Flarum\Group\Event\Saving;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Illuminate\Contracts\Events\Dispatcher;
class EditGroupHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Notification\Command;
use Flarum\User\User;

View File

@ -9,10 +9,10 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Notification\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\Notification\NotificationRepository;
use Flarum\User\AssertPermissionTrait;
class ReadAllNotificationsHandler
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Notification\Command;
use Flarum\User\User;

View File

@ -9,10 +9,10 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Notification\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\Notification\Notification;
use Flarum\User\AssertPermissionTrait;
class ReadNotificationHandler
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Post\Command;
use Flarum\User\User;

View File

@ -9,13 +9,12 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Post\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Post\PostRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Post\Event\Deleting;
use Flarum\Post\PostRepository;
use Flarum\User\AssertPermissionTrait;
use Illuminate\Contracts\Events\Dispatcher;
class DeletePostHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Post\Command;
use Flarum\User\User;

View File

@ -9,14 +9,14 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Post\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\Post\CommentPost;
use Flarum\Post\PostRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Post\PostValidator;
use Flarum\Post\CommentPost;
use Flarum\Post\Event\Saving;
use Flarum\Post\PostRepository;
use Flarum\Post\PostValidator;
use Flarum\User\AssertPermissionTrait;
use Illuminate\Contracts\Events\Dispatcher;
class EditPostHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Post\Command;
use Flarum\User\User;

View File

@ -9,16 +9,16 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\Post\Command;
use DateTime;
use Flarum\User\AssertPermissionTrait;
use Flarum\Notification\NotificationSyncer;
use Flarum\Post\CommentPost;
use Flarum\Discussion\DiscussionRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Post\PostValidator;
use Flarum\Notification\NotificationSyncer;
use Flarum\Post\CommentPost;
use Flarum\Post\Event\Saving;
use Flarum\Post\PostValidator;
use Flarum\User\AssertPermissionTrait;
use Illuminate\Contracts\Events\Dispatcher;
class PostReplyHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
class ConfirmEmail
{

View File

@ -9,16 +9,16 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\EmailToken;
use Flarum\User\UserRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Illuminate\Contracts\Events\Dispatcher;
class ConfirmEmailHandler
{
use Flarum\Foundation\DispatchEventsTrait;
use DispatchEventsTrait;
/**
* @var \Flarum\User\UserRepository

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Flarum\User\User;

View File

@ -9,13 +9,12 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\User\UserRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Event\AvatarWillBeDeleted;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\UserRepository;
use Illuminate\Contracts\Events\Dispatcher;
use League\Flysystem\FilesystemInterface;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Flarum\User\User;

View File

@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\Event\Deleting;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\User\UserRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\Event\Deleting;
use Illuminate\Contracts\Events\Dispatcher;
class DeleteUserHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Flarum\User\User;

View File

@ -9,15 +9,15 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\UserRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\User;
use Flarum\User\UserValidator;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\Event\GroupsChanged;
use Flarum\User\Event\Saving;
use Flarum\User\User;
use Flarum\User\UserRepository;
use Flarum\User\UserValidator;
use Illuminate\Contracts\Events\Dispatcher;
class EditUserHandler

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Flarum\User\User;

View File

@ -9,18 +9,18 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Exception;
use Flarum\Foundation\Application;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\AuthToken;
use Flarum\User\Event\Saving;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\User;
use Flarum\User\UserValidator;
use Flarum\User\Event\Saving;
use Flarum\Foundation\Application;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Validation\Factory;
use Illuminate\Contracts\Validation\ValidationException;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
class RequestPasswordReset
{

View File

@ -9,13 +9,12 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Flarum\Core;
use Flarum\User\PasswordToken;
use Flarum\User\UserRepository;
use Flarum\Forum\UrlGenerator;
use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\User\PasswordToken;
use Flarum\User\UserRepository;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Contracts\Validation\Factory;
use Illuminate\Contracts\Validation\ValidationException;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Flarum\User\User;
use Psr\Http\Message\UploadedFileInterface;

View File

@ -9,15 +9,15 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Command;
namespace Flarum\User\Command;
use Exception;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\UserRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AvatarValidator;
use Flarum\Event\AvatarWillBeSaved;
use Flarum\Foundation\Application;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\UserRepository;
use Flarum\User\AvatarValidator;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Support\Str;
use Intervention\Image\ImageManager;

View File

@ -41,15 +41,15 @@ class UserServiceProvider extends AbstractServiceProvider
return $app->make('Illuminate\Contracts\Filesystem\Factory')->disk('flarum-avatars')->getDriver();
};
$this->app->when('Flarum\Core\Command\UploadAvatarHandler')
$this->app->when('Flarum\User\Command\UploadAvatarHandler')
->needs('League\Flysystem\FilesystemInterface')
->give($avatarsFilesystem);
$this->app->when('Flarum\Core\Command\DeleteAvatarHandler')
$this->app->when('Flarum\User\Command\DeleteAvatarHandler')
->needs('League\Flysystem\FilesystemInterface')
->give($avatarsFilesystem);
$this->app->when('Flarum\Core\Command\RegisterUserHandler')
$this->app->when('Flarum\User\Command\RegisterUserHandler')
->needs('League\Flysystem\FilesystemInterface')
->give($avatarsFilesystem);
}