mirror of
https://github.com/flarum/framework.git
synced 2024-11-30 13:36:10 +08:00
Finalize Flarum\Foundation namespace
This commit is contained in:
parent
d0b5aa2338
commit
d851699c97
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Flarum\Core\Validator;
|
||||
|
||||
use Flarum\Foundation\AbstractValidator;
|
||||
|
||||
class DiscussionValidator extends AbstractValidator
|
||||
{
|
||||
protected $rules = [
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Flarum\Core\Validator;
|
||||
|
||||
use Flarum\Foundation\AbstractValidator;
|
||||
|
||||
class GroupValidator extends AbstractValidator
|
||||
{
|
||||
protected $rules = [
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Flarum\Core\Validator;
|
||||
|
||||
use Flarum\Foundation\AbstractValidator;
|
||||
|
||||
class PostValidator extends AbstractValidator
|
||||
{
|
||||
protected $rules = [
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Support;
|
||||
namespace Flarum\Foundation;
|
||||
|
||||
trait EventGeneratorTrait
|
||||
{
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Exception;
|
||||
namespace Flarum\Foundation;
|
||||
|
||||
use Exception;
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Flarum\User;
|
||||
|
||||
use Flarum\Core\Validator\AbstractValidator;
|
||||
use Flarum\Foundation\AbstractValidator;
|
||||
|
||||
class AvatarValidator extends AbstractValidator
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Flarum\User;
|
||||
|
||||
use Flarum\Core\Validator\AbstractValidator;
|
||||
use Flarum\Foundation\AbstractValidator;
|
||||
|
||||
class UserValidator extends AbstractValidator
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user