Finalize Flarum\Foundation namespace

This commit is contained in:
Franz Liedke 2017-06-24 13:25:49 +02:00
parent d0b5aa2338
commit d851699c97
33 changed files with 63 additions and 57 deletions

View File

@ -12,7 +12,7 @@
namespace Flarum\Api\ExceptionHandler;
use Exception;
use Flarum\Core\Exception\ValidationException;
use Flarum\Foundation\ValidationException;
use Tobscure\JsonApi\Exception\Handler\ExceptionHandlerInterface;
use Tobscure\JsonApi\Exception\Handler\ResponseBag;

View File

@ -13,12 +13,12 @@ namespace Flarum\Core\Command;
use Flarum\User\EmailToken;
use Flarum\User\UserRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Illuminate\Contracts\Events\Dispatcher;
class ConfirmEmailHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
/**
* @var \Flarum\User\UserRepository

View File

@ -14,14 +14,14 @@ namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Core\Group;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Core\Validator\GroupValidator;
use Flarum\Event\GroupWillBeSaved;
use Illuminate\Contracts\Events\Dispatcher;
class CreateGroupHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -14,14 +14,14 @@ namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\User\UserRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Event\AvatarWillBeDeleted;
use Illuminate\Contracts\Events\Dispatcher;
use League\Flysystem\FilesystemInterface;
class DeleteAvatarHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -14,13 +14,13 @@ namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Core\Repository\DiscussionRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Event\DiscussionWillBeDeleted;
use Illuminate\Contracts\Events\Dispatcher;
class DeleteDiscussionHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -14,13 +14,13 @@ namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Core\Repository\GroupRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Event\GroupWillBeDeleted;
use Illuminate\Contracts\Events\Dispatcher;
class DeleteGroupHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -14,13 +14,13 @@ namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Core\Repository\PostRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Event\PostWillBeDeleted;
use Illuminate\Contracts\Events\Dispatcher;
class DeletePostHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -14,13 +14,13 @@ namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\User\UserRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\Event\Deleting;
use Illuminate\Contracts\Events\Dispatcher;
class DeleteUserHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -14,14 +14,14 @@ namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Core\Repository\DiscussionRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Core\Validator\DiscussionValidator;
use Flarum\Event\DiscussionWillBeSaved;
use Illuminate\Contracts\Events\Dispatcher;
class EditDiscussionHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -15,14 +15,14 @@ use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Core\Group;
use Flarum\Core\Repository\GroupRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Core\Validator\GroupValidator;
use Flarum\Event\GroupWillBeSaved;
use Illuminate\Contracts\Events\Dispatcher;
class EditGroupHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -14,14 +14,14 @@ namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\Core\Post\CommentPost;
use Flarum\Core\Repository\PostRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Core\Validator\PostValidator;
use Flarum\Event\PostWillBeSaved;
use Illuminate\Contracts\Events\Dispatcher;
class EditPostHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -13,7 +13,7 @@ namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\UserRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\User;
use Flarum\User\UserValidator;
use Flarum\User\Event\GroupsChanged;
@ -22,7 +22,7 @@ use Illuminate\Contracts\Events\Dispatcher;
class EditUserHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -16,14 +16,14 @@ use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\Core\Notification\NotificationSyncer;
use Flarum\Core\Post\CommentPost;
use Flarum\Core\Repository\DiscussionRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Core\Validator\PostValidator;
use Flarum\Event\PostWillBeSaved;
use Illuminate\Contracts\Events\Dispatcher;
class PostReplyHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -13,13 +13,13 @@ namespace Flarum\Core\Command;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\Core\Repository\DiscussionRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Event\DiscussionStateWillBeSaved;
use Illuminate\Contracts\Events\Dispatcher;
class ReadDiscussionHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -15,7 +15,7 @@ use Exception;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\AuthToken;
use Flarum\User\Exception\PermissionDeniedException;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\User;
use Flarum\User\UserValidator;
use Flarum\User\Event\Saving;
@ -33,7 +33,7 @@ use League\Flysystem\MountManager;
class RegisterUserHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -14,7 +14,7 @@ namespace Flarum\Core\Command;
use Exception;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\Core\Discussion;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Core\Validator\DiscussionValidator;
use Flarum\Event\DiscussionWillBeSaved;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
@ -22,7 +22,7 @@ use Illuminate\Contracts\Events\Dispatcher as EventDispatcher;
class StartDiscussionHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -14,7 +14,7 @@ namespace Flarum\Core\Command;
use Exception;
use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\User\UserRepository;
use Flarum\Core\Support\DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\User\AvatarValidator;
use Flarum\Event\AvatarWillBeSaved;
use Flarum\Foundation\Application;
@ -29,7 +29,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
class UploadAvatarHandler
{
use DispatchEventsTrait;
use Flarum\Foundation\DispatchEventsTrait;
use AssertPermissionTrait;
/**

View File

@ -12,7 +12,7 @@
namespace Flarum\Core;
use Flarum\Core\Post\MergeableInterface;
use Flarum\Core\Support\EventGeneratorTrait;
use Flarum\Foundation\EventGeneratorTrait;
use Flarum\Database\ScopeVisibilityTrait;
use Flarum\Database\AbstractModel;
use Flarum\Event\DiscussionWasDeleted;
@ -55,7 +55,7 @@ use Flarum\Util\Str;
*/
class Discussion extends AbstractModel
{
use EventGeneratorTrait;
use Flarum\Foundation\EventGeneratorTrait;
use ScopeVisibilityTrait;
/**

View File

@ -11,7 +11,7 @@
namespace Flarum\Core;
use Flarum\Core\Support\EventGeneratorTrait;
use Flarum\Foundation\EventGeneratorTrait;
use Flarum\Database\AbstractModel;
use Flarum\Event\DiscussionWasRead;
use Illuminate\Database\Eloquent\Builder;
@ -32,7 +32,7 @@ use Illuminate\Database\Eloquent\Builder;
*/
class DiscussionState extends AbstractModel
{
use EventGeneratorTrait;
use Flarum\Foundation\EventGeneratorTrait;
/**
* {@inheritdoc}

View File

@ -11,7 +11,7 @@
namespace Flarum\Core;
use Flarum\Core\Support\EventGeneratorTrait;
use Flarum\Foundation\EventGeneratorTrait;
use Flarum\Database\ScopeVisibilityTrait;
use Flarum\Database\AbstractModel;
use Flarum\Event\GroupWasCreated;
@ -29,7 +29,7 @@ use Flarum\Event\GroupWasRenamed;
*/
class Group extends AbstractModel
{
use EventGeneratorTrait;
use Flarum\Foundation\EventGeneratorTrait;
use ScopeVisibilityTrait;
/**

View File

@ -12,7 +12,7 @@
namespace Flarum\Core;
use Flarum\Core\Post\RegisteredTypesScope;
use Flarum\Core\Support\EventGeneratorTrait;
use Flarum\Foundation\EventGeneratorTrait;
use Flarum\Database\ScopeVisibilityTrait;
use Flarum\Database\AbstractModel;
use Flarum\Event\PostWasDeleted;
@ -39,7 +39,7 @@ use Illuminate\Database\Eloquent\Builder;
*/
class Post extends AbstractModel
{
use EventGeneratorTrait;
use Flarum\Foundation\EventGeneratorTrait;
use ScopeVisibilityTrait;
/**

View File

@ -11,6 +11,8 @@
namespace Flarum\Core\Validator;
use Flarum\Foundation\AbstractValidator;
class DiscussionValidator extends AbstractValidator
{
protected $rules = [

View File

@ -11,6 +11,8 @@
namespace Flarum\Core\Validator;
use Flarum\Foundation\AbstractValidator;
class GroupValidator extends AbstractValidator
{
protected $rules = [

View File

@ -11,6 +11,8 @@
namespace Flarum\Core\Validator;
use Flarum\Foundation\AbstractValidator;
class PostValidator extends AbstractValidator
{
protected $rules = [

View File

@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Validator;
namespace Flarum\Foundation;
use Flarum\Event\ConfigureValidator;
use Flarum\Foundation\Event\Validating;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Validation\ValidationException;
use Illuminate\Validation\Factory;
@ -94,7 +94,7 @@ abstract class AbstractValidator
$validator = $this->validator->make($attributes, $rules, $this->getMessages());
$this->events->fire(
new ConfigureValidator($this, $validator)
new Validating($this, $validator)
);
return $validator;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Support;
namespace Flarum\Foundation;
use Flarum\User\User;
use Illuminate\Contracts\Events\Dispatcher;

View File

@ -9,20 +9,20 @@
* file that was distributed with this source code.
*/
namespace Flarum\Event;
namespace Flarum\Foundation\Event;
use Flarum\Core\Validator\AbstractValidator;
use Flarum\Foundation\AbstractValidator;
use Illuminate\Validation\Validator;
/**
* The `ConfigureModelValidator` event is called when a validator instance for a
* The `Validating` event is called when a validator instance for a
* model is being built. This event can be used to add custom rules/extensions
* to the validator for when validation takes place.
*/
class ConfigureValidator
class Validating
{
/**
* @var AbstractValidator
* @var \Flarum\Foundation\AbstractValidator
*/
public $type;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core\Support;
namespace Flarum\Foundation;
trait EventGeneratorTrait
{

View File

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

View File

@ -11,7 +11,7 @@
namespace Flarum\User;
use Flarum\Core\Validator\AbstractValidator;
use Flarum\Foundation\AbstractValidator;
class AvatarValidator extends AbstractValidator
{

View File

@ -16,7 +16,7 @@ use Flarum\User\Gate;
use Flarum\Core\Group;
use Flarum\Core\Notification;
use Flarum\Core\Permission;
use Flarum\Core\Support\EventGeneratorTrait;
use Flarum\Foundation\EventGeneratorTrait;
use Flarum\Database\ScopeVisibilityTrait;
use Flarum\Database\AbstractModel;
use Flarum\Event\CheckUserPassword;
@ -56,7 +56,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
*/
class User extends AbstractModel
{
use EventGeneratorTrait;
use Flarum\Foundation\EventGeneratorTrait;
use ScopeVisibilityTrait;
/**

View File

@ -11,7 +11,7 @@
namespace Flarum\User;
use Flarum\Core\Validator\AbstractValidator;
use Flarum\Foundation\AbstractValidator;
class UserValidator extends AbstractValidator
{

View File

@ -13,7 +13,7 @@ namespace Tests\Flarum\Api\Handler;
use Exception;
use Flarum\Api\ExceptionHandler\ValidationExceptionHandler;
use Flarum\Core\Exception\ValidationException;
use Flarum\Foundation\ValidationException;
use Tests\Test\TestCase;
class ValidationExceptionHandlerTest extends TestCase