Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Code cleanup #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 21 additions & 15 deletions app/Moderation/ModerationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@

use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use MyBB\Core\Moderation\Moderations\Approve;
use MyBB\Core\Database\Repositories\Eloquent\ModerationLogRepository;
use MyBB\Core\Database\Repositories\Eloquent\ModerationLogSubjectRepository;
use MyBB\Core\Database\Repositories\ModerationLogRepositoryInterface;
use MyBB\Core\Database\Repositories\ModerationLogSubjectRepositoryInterface;
use MyBB\Core\Moderation\Logger\DatabaseLogger;
use MyBB\Core\Moderation\Logger\ModerationLoggerInterface;
use MyBB\Core\Moderation\Moderations;

class ModerationServiceProvider extends ServiceProvider
{
Expand All @@ -21,31 +27,31 @@ class ModerationServiceProvider extends ServiceProvider
*/
public function register()
{
$this->app->singleton('MyBB\Core\Moderation\ModerationRegistry', function (Application $app) {
$this->app->singleton(ModerationRegistry::class, function (Application $app) {
return new ModerationRegistry([
$app->make('MyBB\Core\Moderation\Moderations\Approve'),
$app->make('MyBB\Core\Moderation\Moderations\MovePost'),
$app->make('MyBB\Core\Moderation\Moderations\MergePosts'),
$app->make('MyBB\Core\Moderation\Moderations\DeletePost'),
$app->make('MyBB\Core\Moderation\Moderations\DeleteTopic'),
$app->make('MyBB\Core\Moderation\Moderations\Close'),
$app->make('MyBB\Core\Moderation\Moderations\MoveTopic')
$app->make(Moderations\Approve::class),
$app->make(Moderations\MovePost::class),
$app->make(Moderations\MergePosts::class),
$app->make(Moderations\DeletePost::class),
$app->make(Moderations\DeleteTopic::class),
$app->make(Moderations\Close::class),
$app->make(Moderations\MoveTopic::class)
]);
});

$this->app->bind(
'MyBB\Core\Database\Repositories\ModerationLogRepositoryInterface',
'MyBB\Core\Database\Repositories\Eloquent\ModerationLogRepository'
ModerationLogRepositoryInterface::class,
ModerationLogRepository::class
);

$this->app->bind(
'MyBB\Core\Database\Repositories\ModerationLogSubjectRepositoryInterface',
'MyBB\Core\Database\Repositories\Eloquent\ModerationLogSubjectRepository'
ModerationLogSubjectRepositoryInterface::class,
ModerationLogSubjectRepository::class
);

$this->app->bind(
'MyBB\Core\Moderation\Logger\ModerationLoggerInterface',
'MyBB\Core\Moderation\Logger\DatabaseLogger'
ModerationLoggerInterface::class,
DatabaseLogger::class
);
}
}
3 changes: 2 additions & 1 deletion app/Moderation/Moderations/Approve.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use McCool\LaravelAutoPresenter\HasPresenter;
use MyBB\Core\Moderation\ReversibleModerationInterface;
use MyBB\Core\Moderation\SourceableInterface;
use MyBB\Core\Presenters\Moderations\ApprovePresenter;

class Approve implements ReversibleModerationInterface, HasPresenter, SourceableInterface
{
Expand Down Expand Up @@ -112,7 +113,7 @@ public function visible($content)
*/
public function getPresenterClass()
{
return 'MyBB\Core\Presenters\Moderations\ApprovePresenter';
return ApprovePresenter::class;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion app/Moderation/Moderations/Close.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use McCool\LaravelAutoPresenter\HasPresenter;
use MyBB\Core\Moderation\ReversibleModerationInterface;
use MyBB\Core\Moderation\SourceableInterface;
use MyBB\Core\Presenters\Moderations\ClosePresenter;

class Close implements ReversibleModerationInterface, HasPresenter, SourceableInterface
{
Expand Down Expand Up @@ -112,7 +113,7 @@ public function getReverseName()
*/
public function getPresenterClass()
{
return 'MyBB\Core\Presenters\Moderations\ClosePresenter';
return ClosePresenter::class;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion app/Moderation/Moderations/DeletePost.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use MyBB\Core\Database\Models\Post;
use MyBB\Core\Database\Repositories\PostRepositoryInterface;
use MyBB\Core\Moderation\ModerationInterface;
use MyBB\Core\Presenters\Moderations\DeletePostPresenter;

class DeletePost implements ModerationInterface, HasPresenter
{
Expand Down Expand Up @@ -93,7 +94,7 @@ public function visible($content)
*/
public function getPresenterClass()
{
return 'MyBB\Core\Presenters\Moderations\DeletePostPresenter';
return DeletePostPresenter::class;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion app/Moderation/Moderations/DeleteTopic.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use McCool\LaravelAutoPresenter\HasPresenter;
use MyBB\Core\Database\Models\Topic;
use MyBB\Core\Moderation\ModerationInterface;
use MyBB\Core\Presenters\Moderations\DeleteTopicPresenter;
use MyBB\Core\Services\TopicDeleter;

class DeleteTopic implements ModerationInterface, HasPresenter
Expand Down Expand Up @@ -93,7 +94,7 @@ public function visible($content)
*/
public function getPresenterClass()
{
return 'MyBB\Core\Presenters\Moderations\DeleteTopicPresenter';
return DeleteTopicPresenter::class;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion app/Moderation/Moderations/MergePosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use MyBB\Core\Database\Repositories\PostRepositoryInterface;
use MyBB\Core\Moderation\ArrayModerationInterface;
use MyBB\Core\Moderation\SourceableInterface;
use MyBB\Core\Presenters\Moderations\MergePostsPresenter;

class MergePosts implements ArrayModerationInterface, HasPresenter, SourceableInterface
{
Expand Down Expand Up @@ -98,7 +99,7 @@ public function visible($content)
*/
public function getPresenterClass()
{
return 'MyBB\Core\Presenters\Moderations\MergePostsPresenter';
return MergePostsPresenter::class;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion app/Moderation/Moderations/MovePost.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use MyBB\Core\Moderation\DestinedInterface;
use MyBB\Core\Moderation\ModerationInterface;
use MyBB\Core\Moderation\SourceableInterface;
use MyBB\Core\Presenters\Moderations\MovePostPresenter;

class MovePost implements ModerationInterface, HasPresenter, DestinedInterface, SourceableInterface
{
Expand Down Expand Up @@ -88,7 +89,7 @@ public function supports($content, array $options = [])
*/
public function getPresenterClass()
{
return 'MyBB\Core\Presenters\Moderations\MovePostPresenter';
return MovePostPresenter::class;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion app/Moderation/Moderations/MoveTopic.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use MyBB\Core\Moderation\DestinedInterface;
use MyBB\Core\Moderation\ModerationInterface;
use MyBB\Core\Moderation\SourceableInterface;
use MyBB\Core\Presenters\Moderations\MoveTopicPresenter;

class MoveTopic implements ModerationInterface, HasPresenter, DestinedInterface, SourceableInterface
{
Expand Down Expand Up @@ -98,7 +99,7 @@ public function visible($content)
*/
public function getPresenterClass()
{
return 'MyBB\Core\Presenters\Moderations\MoveTopicPresenter';
return MoveTopicPresenter::class;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Conversation extends BasePresenter
*/
public function __construct(ConversationModel $resource, Guard $guard)
{
$this->wrappedObject = $resource;
parent::__construct($resource);
$this->guard = $guard;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/ConversationMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ConversationMessage extends BasePresenter
*/
public function __construct(ConversationMessageModel $resource)
{
$this->wrappedObject = $resource;
parent::__construct($resource);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/Forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Forum extends BasePresenter
*/
public function __construct(ForumModel $resource, Application $app, ModerationRegistry $moderations)
{
$this->wrappedObject = $resource;
parent::__construct($resource);
$this->app = $app;
$this->moderations = $moderations;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/Poll.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(
PollVoteRepositoryInterface $pollVoteRepository,
Guard $guard
) {
$this->wrappedObject = $resource;
parent::__construct($resource);
$this->pollVoteRepository = $pollVoteRepository;
$this->guard = $guard;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Post extends BasePresenter
*/
public function __construct(PostModel $resource, Guard $guard, Application $app)
{
$this->wrappedObject = $resource;
parent::__construct($resource);
$this->guard = $guard;
$this->app = $app;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/ProfileFieldGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ProfileFieldGroup extends BasePresenter
*/
public function __construct(ProfileFieldGroupModel $resource, Application $app)
{
$this->wrappedObject = $resource;
parent::__construct($resource);
$this->app = $app;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/Topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Topic extends BasePresenter
*/
public function __construct(TopicModel $resource, ModerationRegistry $moderations, Application $app)
{
$this->wrappedObject = $resource;
parent::__construct($resource);
$this->moderations = $moderations;
$this->app = $app;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function __construct(
Store $settings,
Guard $guard
) {
$this->wrappedObject = $resource;
parent::__construct($resource);
$this->router = $router;
$this->forumRepository = $forumRepository;
$this->topicRepository = $topicRepository;
Expand Down