mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 16:52:46 +08:00
Applied fixes from StyleCI
This commit is contained in:
parent
83c22d73a4
commit
a6cf10f854
|
@ -8,7 +8,6 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
|
|
|
@ -10,17 +10,17 @@
|
|||
|
||||
namespace Flarum\Admin\Controller;
|
||||
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Core\Permission;
|
||||
use Flarum\Event\PrepareUnserializedSettings;
|
||||
use Flarum\Extension\ExtensionManager;
|
||||
use Flarum\Foundation\Application;
|
||||
use Flarum\Http\Controller\AbstractClientController as BaseClientController;
|
||||
use Flarum\Extension\ExtensionManager;
|
||||
use Flarum\Locale\LocaleManager;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Cache\Repository;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Core\Permission;
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\Event\PrepareUnserializedSettings;
|
||||
|
||||
class ClientController extends BaseClientController
|
||||
{
|
||||
|
|
|
@ -13,12 +13,10 @@ namespace Flarum\Admin\Middleware;
|
|||
use Exception;
|
||||
use Flarum\Core\Access\AssertPermissionTrait;
|
||||
use Flarum\Forum\Controller\LogInController;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Zend\Diactoros\Response\RedirectResponse;
|
||||
use Zend\Stratigility\MiddlewareInterface;
|
||||
|
||||
class RequireAdministrateAbility implements MiddlewareInterface
|
||||
|
|
|
@ -28,7 +28,7 @@ class Server extends AbstractServer
|
|||
|
||||
if ($app->isInstalled()) {
|
||||
$path = parse_url($app->url('admin'), PHP_URL_PATH);
|
||||
$errorDir = __DIR__ . '/../../error';
|
||||
$errorDir = __DIR__.'/../../error';
|
||||
|
||||
if ($app->isUpToDate()) {
|
||||
$pipe->pipe($path, $app->make('Flarum\Http\Middleware\ParseJsonBody'));
|
||||
|
|
|
@ -60,7 +60,7 @@ class Client
|
|||
|
||||
if (! ($controller instanceof ControllerInterface)) {
|
||||
throw new InvalidArgumentException('Endpoint must be an instance of '
|
||||
. ControllerInterface::class);
|
||||
.ControllerInterface::class);
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -87,7 +87,7 @@ class ListPostsController extends AbstractCollectionController
|
|||
if (($near = array_get($queryParams, 'page.near')) > 1) {
|
||||
if (count($filter) > 1 || ! isset($filter['discussion']) || $sort) {
|
||||
throw new InvalidParameterException('You can only use page[near] with '
|
||||
. 'filter[discussion] and the default sort order');
|
||||
.'filter[discussion] and the default sort order');
|
||||
}
|
||||
|
||||
$offset = $this->posts->getIndexForNumber($filter['discussion'], $near, $actor);
|
||||
|
|
|
@ -25,12 +25,12 @@ class ShowDiscussionController extends AbstractResourceController
|
|||
protected $discussions;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $serializer = 'Flarum\Api\Serializer\DiscussionSerializer';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $include = [
|
||||
'posts',
|
||||
|
@ -42,7 +42,7 @@ class ShowDiscussionController extends AbstractResourceController
|
|||
];
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $optionalInclude = [
|
||||
'startUser',
|
||||
|
|
|
@ -68,9 +68,9 @@ class TokenController implements ControllerInterface
|
|||
$token = AccessToken::generate($user->id, $lifetime);
|
||||
$token->save();
|
||||
|
||||
return (new JsonResponse([
|
||||
return new JsonResponse([
|
||||
'token' => $token->id,
|
||||
'userId' => $user->id
|
||||
]));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@ namespace Flarum\Api\Serializer;
|
|||
|
||||
use Closure;
|
||||
use DateTime;
|
||||
use Flarum\Api\Relationship\HasManyBuilder;
|
||||
use Flarum\Api\Relationship\HasOneBuilder;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Event\GetApiRelationship;
|
||||
use Flarum\Event\PrepareApiAttributes;
|
||||
|
@ -24,7 +22,6 @@ use LogicException;
|
|||
use Tobscure\JsonApi\AbstractSerializer as BaseAbstractSerializer;
|
||||
use Tobscure\JsonApi\Collection;
|
||||
use Tobscure\JsonApi\Relationship;
|
||||
use Tobscure\JsonApi\Relationship\BuilderInterface;
|
||||
use Tobscure\JsonApi\Resource;
|
||||
use Tobscure\JsonApi\SerializerInterface;
|
||||
|
||||
|
@ -125,7 +122,7 @@ abstract class AbstractSerializer extends BaseAbstractSerializer
|
|||
|
||||
if ($relationship && ! ($relationship instanceof Relationship)) {
|
||||
throw new LogicException('GetApiRelationship handler must return an instance of '
|
||||
. Relationship::class);
|
||||
.Relationship::class);
|
||||
}
|
||||
|
||||
return $relationship;
|
||||
|
|
|
@ -30,7 +30,7 @@ class DiscussionBasicSerializer extends AbstractSerializer
|
|||
{
|
||||
if (! ($discussion instanceof Discussion)) {
|
||||
throw new InvalidArgumentException(get_class($this)
|
||||
. ' can only serialize instances of ' . Discussion::class);
|
||||
.' can only serialize instances of '.Discussion::class);
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
|
@ -44,7 +44,7 @@ class GroupSerializer extends AbstractSerializer
|
|||
{
|
||||
if (! ($group instanceof Group)) {
|
||||
throw new InvalidArgumentException(get_class($this)
|
||||
. ' can only serialize instances of ' . Group::class);
|
||||
.' can only serialize instances of '.Group::class);
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
|
@ -38,7 +38,7 @@ class NotificationSerializer extends AbstractSerializer
|
|||
{
|
||||
if (! ($notification instanceof Notification)) {
|
||||
throw new InvalidArgumentException(get_class($this)
|
||||
. ' can only serialize instances of ' . Notification::class);
|
||||
.' can only serialize instances of '.Notification::class);
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
|
@ -31,7 +31,7 @@ class PostBasicSerializer extends AbstractSerializer
|
|||
{
|
||||
if (! ($post instanceof Post)) {
|
||||
throw new InvalidArgumentException(get_class($this)
|
||||
. ' can only serialize instances of ' . Post::class);
|
||||
.' can only serialize instances of '.Post::class);
|
||||
}
|
||||
|
||||
$attributes = [
|
||||
|
|
|
@ -30,7 +30,7 @@ class UserBasicSerializer extends AbstractSerializer
|
|||
{
|
||||
if (! ($user instanceof User)) {
|
||||
throw new InvalidArgumentException(get_class($this)
|
||||
. ' can only serialize instances of ' . User::class);
|
||||
.' can only serialize instances of '.User::class);
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
|
@ -39,8 +39,8 @@ class AssetManager
|
|||
*/
|
||||
public function setFilename($filename)
|
||||
{
|
||||
$this->js->setFilename($filename . '.js');
|
||||
$this->less->setFilename($filename . '.css');
|
||||
$this->js->setFilename($filename.'.js');
|
||||
$this->less->setFilename($filename.'.css');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,7 +61,7 @@ class AssetManager
|
|||
break;
|
||||
|
||||
default:
|
||||
throw new DomainException('Unsupported asset type: ' . $ext);
|
||||
throw new DomainException('Unsupported asset type: '.$ext);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class JsCompiler extends RevisionCompiler
|
|||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getCacheDifferentiator()
|
||||
{
|
||||
|
|
|
@ -104,7 +104,7 @@ class RevisionCompiler implements CompilerInterface
|
|||
*/
|
||||
protected function getCacheDifferentiator()
|
||||
{
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -189,7 +189,7 @@ class RevisionCompiler implements CompilerInterface
|
|||
|
||||
$ext = pathinfo($this->filename, PATHINFO_EXTENSION);
|
||||
|
||||
$file = $this->path . '/' . substr_replace($this->filename, '-' . $revision, -strlen($ext) - 1, 0);
|
||||
$file = $this->path.'/'.substr_replace($this->filename, '-'.$revision, -strlen($ext) - 1, 0);
|
||||
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
|
|
|
@ -10,10 +10,8 @@
|
|||
|
||||
namespace Flarum\Console\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
use Flarum\Foundation\Application;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
|
||||
class GenerateExtensionCommand extends AbstractCommand
|
||||
{
|
||||
|
@ -21,7 +19,7 @@ class GenerateExtensionCommand extends AbstractCommand
|
|||
{
|
||||
$this
|
||||
->setName('generate:extension')
|
||||
->setDescription("Generate a Flarum extension skeleton.");
|
||||
->setDescription('Generate a Flarum extension skeleton.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,10 +10,9 @@
|
|||
|
||||
namespace Flarum\Console\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
use Flarum\Database\MigrationCreator;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class GenerateMigrationCommand extends AbstractCommand
|
||||
{
|
||||
|
@ -39,7 +38,7 @@ class GenerateMigrationCommand extends AbstractCommand
|
|||
{
|
||||
$this
|
||||
->setName('generate:migration')
|
||||
->setDescription("Generate a migration.")
|
||||
->setDescription('Generate a migration.')
|
||||
->addArgument(
|
||||
'name',
|
||||
InputArgument::REQUIRED,
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Access;
|
||||
|
||||
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
|
||||
|
|
|
@ -45,7 +45,7 @@ class PostPolicy extends AbstractPolicy
|
|||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ class EditDiscussion
|
|||
/**
|
||||
* The ID of the discussion to edit.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
public $discussionId;
|
||||
|
||||
|
@ -36,7 +36,7 @@ class EditDiscussion
|
|||
public $data;
|
||||
|
||||
/**
|
||||
* @param integer $discussionId The ID of the discussion to edit.
|
||||
* @param int $discussionId The ID of the discussion to edit.
|
||||
* @param \Flarum\Core\User $actor The user performing the action.
|
||||
* @param array $data The attributes to update on the discussion.
|
||||
*/
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
namespace Flarum\Core\Command;
|
||||
|
||||
use Flarum\Core\Access\AssertPermissionTrait;
|
||||
use Flarum\Core\Notification;
|
||||
use Flarum\Core\Repository\NotificationRepository;
|
||||
|
||||
class ReadAllNotificationsHandler
|
||||
|
|
|
@ -17,7 +17,7 @@ class ReadDiscussion
|
|||
/**
|
||||
* The ID of the discussion to mark as read.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
public $discussionId;
|
||||
|
||||
|
@ -31,14 +31,14 @@ class ReadDiscussion
|
|||
/**
|
||||
* The number of the post to mark as read.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
public $readNumber;
|
||||
|
||||
/**
|
||||
* @param integer $discussionId The ID of the discussion to mark as read.
|
||||
* @param int $discussionId The ID of the discussion to mark as read.
|
||||
* @param User $actor The user to mark the discussion as read for.
|
||||
* @param integer $readNumber The number of the post to mark as read.
|
||||
* @param int $readNumber The number of the post to mark as read.
|
||||
*/
|
||||
public function __construct($discussionId, User $actor, $readNumber)
|
||||
{
|
||||
|
|
|
@ -170,10 +170,10 @@ class RegisterUserHandler
|
|||
'target' => $this->uploadDir,
|
||||
]);
|
||||
|
||||
$uploadName = Str::lower(Str::quickRandom()) . '.jpg';
|
||||
$uploadName = Str::lower(Str::quickRandom()).'.jpg';
|
||||
|
||||
$user->changeAvatarPath($uploadName);
|
||||
|
||||
$mount->move("source://".pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName");
|
||||
$mount->move('source://'.pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
namespace Flarum\Core\Command;
|
||||
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\Core;
|
||||
use Flarum\Core\PasswordToken;
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Illuminate\Contracts\Mail\Mailer;
|
||||
use Illuminate\Mail\Message;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Flarum\Core;
|
||||
use Flarum\Forum\UrlGenerator;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Mail\Mailer;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Mail\Message;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
class RequestPasswordResetHandler
|
||||
|
|
|
@ -111,11 +111,11 @@ class UploadAvatarHandler
|
|||
$mount->delete($file);
|
||||
}
|
||||
|
||||
$uploadName = Str::lower(Str::quickRandom()) . '.jpg';
|
||||
$uploadName = Str::lower(Str::quickRandom()).'.jpg';
|
||||
|
||||
$user->changeAvatarPath($uploadName);
|
||||
|
||||
$mount->move("source://".pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName");
|
||||
$mount->move('source://'.pathinfo($tmpFile, PATHINFO_BASENAME), "target://$uploadName");
|
||||
|
||||
$user->save();
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
namespace Flarum\Core;
|
||||
|
||||
use Flarum\Core\Post;
|
||||
use Flarum\Core\Post\MergeableInterface;
|
||||
use Flarum\Core\Support\EventGeneratorTrait;
|
||||
use Flarum\Core\Support\ScopeVisibilityTrait;
|
||||
|
@ -119,8 +118,8 @@ class Discussion extends AbstractModel
|
|||
{
|
||||
$discussion = new static;
|
||||
|
||||
$discussion->title = $title;
|
||||
$discussion->start_time = time();
|
||||
$discussion->title = $title;
|
||||
$discussion->start_time = time();
|
||||
$discussion->start_user_id = $user->id;
|
||||
|
||||
$discussion->setRelation('startUser', $user);
|
||||
|
@ -191,7 +190,7 @@ class Discussion extends AbstractModel
|
|||
*/
|
||||
public function setStartPost(Post $post)
|
||||
{
|
||||
$this->start_time = $post->time;
|
||||
$this->start_time = $post->time;
|
||||
$this->start_user_id = $post->user_id;
|
||||
$this->start_post_id = $post->id;
|
||||
|
||||
|
@ -206,9 +205,9 @@ class Discussion extends AbstractModel
|
|||
*/
|
||||
public function setLastPost(Post $post)
|
||||
{
|
||||
$this->last_time = $post->time;
|
||||
$this->last_user_id = $post->user_id;
|
||||
$this->last_post_id = $post->id;
|
||||
$this->last_time = $post->time;
|
||||
$this->last_user_id = $post->user_id;
|
||||
$this->last_post_id = $post->id;
|
||||
$this->last_post_number = $post->number;
|
||||
|
||||
return $this;
|
||||
|
|
|
@ -54,7 +54,7 @@ class DiscussionState extends AbstractModel
|
|||
{
|
||||
if ($number > $this->read_number) {
|
||||
$this->read_number = $number;
|
||||
$this->read_time = time();
|
||||
$this->read_time = time();
|
||||
|
||||
$this->raise(new DiscussionWasRead($this));
|
||||
}
|
||||
|
|
|
@ -81,9 +81,9 @@ class Group extends AbstractModel
|
|||
$group = new static;
|
||||
|
||||
$group->name_singular = $nameSingular;
|
||||
$group->name_plural = $namePlural;
|
||||
$group->color = $color;
|
||||
$group->icon = $icon;
|
||||
$group->name_plural = $namePlural;
|
||||
$group->color = $color;
|
||||
$group->icon = $icon;
|
||||
|
||||
$group->raise(new GroupWasCreated($group));
|
||||
|
||||
|
@ -100,7 +100,7 @@ class Group extends AbstractModel
|
|||
public function rename($nameSingular, $namePlural)
|
||||
{
|
||||
$this->name_singular = $nameSingular;
|
||||
$this->name_plural = $namePlural;
|
||||
$this->name_plural = $namePlural;
|
||||
|
||||
$this->raise(new GroupWasRenamed($this));
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
namespace Flarum\Core\Listener;
|
||||
|
||||
use Flarum\Core\Post;
|
||||
use Flarum\Event\PostWasPosted;
|
||||
use Flarum\Event\PostWasDeleted;
|
||||
use Flarum\Event\PostWasHidden;
|
||||
use Flarum\Event\PostWasPosted;
|
||||
use Flarum\Event\PostWasRestored;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
namespace Flarum\Core\Listener;
|
||||
|
||||
use Flarum\Event\DiscussionWasRenamed;
|
||||
use Flarum\Core\Post\DiscussionRenamedPost;
|
||||
use Flarum\Core\Notification\DiscussionRenamedBlueprint;
|
||||
use Flarum\Core\Notification\NotificationSyncer;
|
||||
use Flarum\Core\Post\DiscussionRenamedPost;
|
||||
use Flarum\Event\DiscussionWasRenamed;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class DiscussionRenamedNotifier
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
namespace Flarum\Core\Listener;
|
||||
|
||||
use Flarum\Core\Post;
|
||||
use Flarum\Core\Discussion;
|
||||
use Flarum\Event\PostWasPosted;
|
||||
use Flarum\Core\Post;
|
||||
use Flarum\Event\DiscussionWasDeleted;
|
||||
use Flarum\Event\DiscussionWasStarted;
|
||||
use Flarum\Event\PostWasDeleted;
|
||||
use Flarum\Event\PostWasHidden;
|
||||
use Flarum\Event\PostWasPosted;
|
||||
use Flarum\Event\PostWasRestored;
|
||||
use Flarum\Event\DiscussionWasStarted;
|
||||
use Flarum\Event\DiscussionWasDeleted;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class UserMetadataUpdater
|
||||
|
|
|
@ -14,7 +14,6 @@ use Flarum\Core\Notification;
|
|||
use Flarum\Core\User;
|
||||
use Flarum\Event\ConfigureNotificationTypes;
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Extend;
|
||||
use ReflectionClass;
|
||||
|
||||
class NotificationServiceProvider extends AbstractServiceProvider
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
namespace Flarum\Core\Notification;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Core\Notification;
|
||||
use Flarum\Core\Repository\NotificationRepository;
|
||||
use Flarum\Event\NotificationWillBeSent;
|
||||
use Flarum\Core\User;
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Event\NotificationWillBeSent;
|
||||
|
||||
/**
|
||||
* The Notification Syncer commits notification blueprints to the database, and
|
||||
|
|
|
@ -10,12 +10,9 @@
|
|||
|
||||
namespace Flarum\Core;
|
||||
|
||||
use DomainException;
|
||||
use Flarum\Core\Post\RegisteredTypesScope;
|
||||
use Flarum\Core\Support\EventGeneratorTrait;
|
||||
use Flarum\Core\Support\Locked;
|
||||
use Flarum\Core\Support\ScopeVisibilityTrait;
|
||||
use Flarum\Core\Support\ValidateBeforeSaveTrait;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Flarum\Event\PostWasDeleted;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
@ -99,7 +96,7 @@ class Post extends AbstractModel
|
|||
* Determine whether or not this post is visible to the given user.
|
||||
*
|
||||
* @param User $user
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isVisibleTo(User $user)
|
||||
{
|
||||
|
|
|
@ -51,11 +51,11 @@ class CommentPost extends Post
|
|||
{
|
||||
$post = new static;
|
||||
|
||||
$post->time = time();
|
||||
$post->time = time();
|
||||
$post->discussion_id = $discussionId;
|
||||
$post->user_id = $userId;
|
||||
$post->type = static::$type;
|
||||
$post->ip_address = $ipAddress;
|
||||
$post->user_id = $userId;
|
||||
$post->type = static::$type;
|
||||
$post->ip_address = $ipAddress;
|
||||
|
||||
// Set content last, as the parsing may rely on other post attributes.
|
||||
$post->content = $content;
|
||||
|
|
|
@ -21,12 +21,12 @@ use Flarum\Core\Post;
|
|||
class DiscussionRenamedPost extends AbstractEventPost implements MergeableInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $type = 'discussionRenamed';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function saveAfter(Post $previous)
|
||||
{
|
||||
|
@ -64,10 +64,10 @@ class DiscussionRenamedPost extends AbstractEventPost implements MergeableInterf
|
|||
{
|
||||
$post = new static;
|
||||
|
||||
$post->content = static::buildContent($oldTitle, $newTitle);
|
||||
$post->time = time();
|
||||
$post->content = static::buildContent($oldTitle, $newTitle);
|
||||
$post->time = time();
|
||||
$post->discussion_id = $discussionId;
|
||||
$post->user_id = $userId;
|
||||
$post->user_id = $userId;
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
namespace Flarum\Core\Repository;
|
||||
|
||||
use Flarum\Core\Discussion;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Flarum\Core\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
|
||||
class DiscussionRepository
|
||||
|
@ -31,7 +31,7 @@ class DiscussionRepository
|
|||
* Find a discussion by ID, optionally making sure it is visible to a
|
||||
* certain user, or throw an exception.
|
||||
*
|
||||
* @param integer $id
|
||||
* @param int $id
|
||||
* @param User $user
|
||||
* @return \Flarum\Core\Discussion
|
||||
*/
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
namespace Flarum\Core\Repository;
|
||||
|
||||
use Flarum\Core\Discussion;
|
||||
use Flarum\Core\Post;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Event\ScopePostVisibility;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Core\Discussion;
|
||||
|
||||
class PostRepository
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ class PostRepository
|
|||
* Find a post by ID, optionally making sure it is visible to a certain
|
||||
* user, or throw an exception.
|
||||
*
|
||||
* @param integer $id
|
||||
* @param int $id
|
||||
* @param \Flarum\Core\User $actor
|
||||
* @return \Flarum\Core\Post
|
||||
*
|
||||
|
@ -56,8 +56,8 @@ class PostRepository
|
|||
* @param array $where
|
||||
* @param \Flarum\Core\User|null $actor
|
||||
* @param array $sort
|
||||
* @param integer $count
|
||||
* @param integer $start
|
||||
* @param int $count
|
||||
* @param int $start
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function findWhere(array $where = [], User $actor = null, $sort = [], $count = null, $start = 0)
|
||||
|
@ -118,10 +118,10 @@ class PostRepository
|
|||
* is. If the post with that number does not exist, the index of the
|
||||
* closest post to it will be returned.
|
||||
*
|
||||
* @param integer $discussionId
|
||||
* @param integer $number
|
||||
* @param int $discussionId
|
||||
* @param int $number
|
||||
* @param \Flarum\Core\User|null $actor
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getIndexForNumber($discussionId, $number, User $actor = null)
|
||||
{
|
||||
|
|
|
@ -71,7 +71,7 @@ class UserRepository
|
|||
*
|
||||
* @param string $username
|
||||
* @param User|null $actor
|
||||
* @return integer|null
|
||||
* @return int|null
|
||||
*/
|
||||
public function getIdForUsername($username, User $actor = null)
|
||||
{
|
||||
|
|
|
@ -27,10 +27,10 @@ abstract class AbstractRegexGambit implements GambitInterface
|
|||
if ($matches = $this->match($bit)) {
|
||||
list($negate) = array_splice($matches, 1, 1);
|
||||
|
||||
$this->conditions($search, $matches, !! $negate);
|
||||
$this->conditions($search, $matches, (bool) $negate);
|
||||
}
|
||||
|
||||
return !! $matches;
|
||||
return (bool) $matches;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
namespace Flarum\Core\Search\Discussion;
|
||||
|
||||
use Flarum\Core\Discussion;
|
||||
use Flarum\Core\Search\ApplySearchParametersTrait;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Core\Search\GambitManager;
|
||||
use Flarum\Core\Repository\DiscussionRepository;
|
||||
use Flarum\Core\Repository\PostRepository;
|
||||
use Flarum\Event\ConfigureDiscussionSearch;
|
||||
use Flarum\Core\Search\ApplySearchParametersTrait;
|
||||
use Flarum\Core\Search\GambitManager;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Core\Search\SearchResults;
|
||||
use Flarum\Event\ConfigureDiscussionSearch;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
namespace Flarum\Core\Search\Discussion\Gambit;
|
||||
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use LogicException;
|
||||
|
||||
class AuthorGambit extends AbstractRegexGambit
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace Flarum\Core\Search\Discussion\Gambit;
|
||||
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use Flarum\Core\Search\Discussion\Fulltext\DriverInterface;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\GambitInterface;
|
||||
use LogicException;
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace Flarum\Core\Search\Discussion\Gambit;
|
||||
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use LogicException;
|
||||
|
||||
class HiddenGambit extends AbstractRegexGambit
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
namespace Flarum\Core\Search\Discussion\Gambit;
|
||||
|
||||
use Flarum\Core\Repository\DiscussionRepository;
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\Discussion\DiscussionSearch;
|
||||
use LogicException;
|
||||
|
||||
class UnreadGambit extends AbstractRegexGambit
|
||||
|
|
|
@ -105,8 +105,8 @@ class GambitManager
|
|||
foreach ($bits as $k => $bit) {
|
||||
foreach ($gambits as $gambit) {
|
||||
if (! $gambit instanceof GambitInterface) {
|
||||
throw new LogicException('GambitInterface ' . get_class($gambit)
|
||||
. ' does not implement ' . GambitInterface::class);
|
||||
throw new LogicException('GambitInterface '.get_class($gambit)
|
||||
.' does not implement '.GambitInterface::class);
|
||||
}
|
||||
|
||||
if ($gambit->apply($search, $bit)) {
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
namespace Flarum\Core\Search\User\Gambit;
|
||||
|
||||
use Flarum\Core\Search\User\UserSearch;
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Flarum\Core\Search\AbstractRegexGambit;
|
||||
use Flarum\Core\Search\AbstractSearch;
|
||||
use Flarum\Core\Search\User\UserSearch;
|
||||
use LogicException;
|
||||
|
||||
class EmailGambit extends AbstractRegexGambit
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
namespace Flarum\Core\Search\User;
|
||||
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Flarum\Core\Search\ApplySearchParametersTrait;
|
||||
use Flarum\Core\Search\GambitManager;
|
||||
use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Core\Search\SearchResults;
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Flarum\Event\ConfigureUserSearch;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace Flarum\Core\Support;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Event\ScopeModelVisibility;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Flarum\Core\User;
|
||||
|
||||
trait ScopeVisibilityTrait
|
||||
{
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
namespace Flarum\Core;
|
||||
|
||||
use DomainException;
|
||||
use Flarum\Core;
|
||||
use Flarum\Core\Access\Gate;
|
||||
use Flarum\Core\Notification;
|
||||
use Flarum\Core\Support\EventGeneratorTrait;
|
||||
use Flarum\Core\Support\ScopeVisibilityTrait;
|
||||
use Flarum\Database\AbstractModel;
|
||||
|
@ -79,7 +77,7 @@ class User extends AbstractModel
|
|||
|
||||
/**
|
||||
* An array of registered user preferences. Each preference is defined with
|
||||
* a key, and its value is an array containing the following keys:
|
||||
* a key, and its value is an array containing the following keys:.
|
||||
*
|
||||
* - transformer: a callback that confines the value of the preference
|
||||
* - default: a default value if the preference isn't set
|
||||
|
@ -155,9 +153,9 @@ class User extends AbstractModel
|
|||
{
|
||||
$user = new static;
|
||||
|
||||
$user->username = $username;
|
||||
$user->email = $email;
|
||||
$user->password = $password;
|
||||
$user->username = $username;
|
||||
$user->email = $email;
|
||||
$user->password = $password;
|
||||
$user->join_time = time();
|
||||
|
||||
$user->raise(new UserWasRegistered($user));
|
||||
|
@ -338,7 +336,7 @@ class User extends AbstractModel
|
|||
* Check if a given password matches the user's password.
|
||||
*
|
||||
* @param string $password
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function checkPassword($password)
|
||||
{
|
||||
|
@ -365,7 +363,7 @@ class User extends AbstractModel
|
|||
* Check whether the user has a certain permission based on their groups.
|
||||
*
|
||||
* @param string $permission
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPermission($permission)
|
||||
{
|
||||
|
@ -385,7 +383,7 @@ class User extends AbstractModel
|
|||
* based on their groups.
|
||||
*
|
||||
* @param string $match
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPermissionLike($match)
|
||||
{
|
||||
|
@ -430,7 +428,7 @@ class User extends AbstractModel
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all notifications that have not been read yet
|
||||
* Get all notifications that have not been read yet.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
|
|
|
@ -28,7 +28,7 @@ abstract class AbstractModel extends Eloquent
|
|||
/**
|
||||
* Indicates if the model should be timestamped. Turn off by default.
|
||||
*
|
||||
* @var boolean
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
|
@ -107,7 +107,7 @@ abstract class AbstractModel extends Eloquent
|
|||
if (! $this->relationLoaded($key) && ($relation = $this->getCustomRelation($key))) {
|
||||
if (! $relation instanceof Relation) {
|
||||
throw new LogicException('Relationship method must return an object of type '
|
||||
. 'Illuminate\Database\Eloquent\Relations\Relation');
|
||||
.'Illuminate\Database\Eloquent\Relations\Relation');
|
||||
}
|
||||
|
||||
return $this->relations[$key] = $relation->getResults();
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
namespace Flarum\Database;
|
||||
|
||||
use Flarum\Core;
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Foundation\Application;
|
||||
use Illuminate\Database\ConnectionResolver;
|
||||
|
|
|
@ -65,8 +65,8 @@ class Migrator
|
|||
Resolver $resolver,
|
||||
Filesystem $files
|
||||
) {
|
||||
$this->files = $files;
|
||||
$this->resolver = $resolver;
|
||||
$this->files = $files;
|
||||
$this->resolver = $resolver;
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ class Migrator
|
|||
*/
|
||||
public function getMigrationFiles($path)
|
||||
{
|
||||
$files = $this->files->glob($path . '/*_*.php');
|
||||
$files = $this->files->glob($path.'/*_*.php');
|
||||
|
||||
if ($files === false) {
|
||||
return [];
|
||||
|
@ -287,7 +287,7 @@ class Migrator
|
|||
*/
|
||||
public function setConnection($name)
|
||||
{
|
||||
if (!is_null($name)) {
|
||||
if (! is_null($name)) {
|
||||
$this->resolver->setDefaultConnection($name);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ class ConfigureNotificationTypes
|
|||
public function add($blueprint, $serializer, $enabledByDefault = [])
|
||||
{
|
||||
if (! (new ReflectionClass($blueprint))->implementsInterface(BlueprintInterface::class)) {
|
||||
throw new InvalidArgumentException('Notification blueprint ' . $blueprint
|
||||
. ' must implement '.BlueprintInterface::class);
|
||||
throw new InvalidArgumentException('Notification blueprint '.$blueprint
|
||||
.' must implement '.BlueprintInterface::class);
|
||||
}
|
||||
|
||||
$this->blueprints[$blueprint] = $enabledByDefault;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Flarum\Event;
|
|||
use Flarum\Core\User;
|
||||
|
||||
/**
|
||||
* The `PrepareUserGroups` event
|
||||
* The `PrepareUserGroups` event.
|
||||
*/
|
||||
class PrepareUserGroups
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ use Flarum\Core\User;
|
|||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
/**
|
||||
* The `ScopeHiddenDiscussionVisibility` event
|
||||
* The `ScopeHiddenDiscussionVisibility` event.
|
||||
*/
|
||||
class ScopeHiddenDiscussionVisibility
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ use Flarum\Core\User;
|
|||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
/**
|
||||
* The `ScopePostVisibility` event
|
||||
* The `ScopePostVisibility` event.
|
||||
*/
|
||||
class ScopePostVisibility
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ class Extension implements Arrayable
|
|||
*/
|
||||
public function __construct($path, $composerJson)
|
||||
{
|
||||
$this->path = $path;
|
||||
$this->path = $path;
|
||||
$this->composerJson = $composerJson;
|
||||
$this->assignId();
|
||||
}
|
||||
|
@ -116,7 +116,6 @@ class Extension implements Arrayable
|
|||
return isset($this->{$name}) || $this->composerJsonAttribute(Str::snake($name, '-'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dot notation getter for composer.json attributes.
|
||||
*
|
||||
|
@ -131,7 +130,7 @@ class Extension implements Arrayable
|
|||
}
|
||||
|
||||
/**
|
||||
* @param boolean $installed
|
||||
* @param bool $installed
|
||||
* @return Extension
|
||||
*/
|
||||
public function setInstalled($installed)
|
||||
|
@ -142,7 +141,7 @@ class Extension implements Arrayable
|
|||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isInstalled()
|
||||
{
|
||||
|
@ -177,15 +176,15 @@ class Extension implements Arrayable
|
|||
{
|
||||
if (($icon = $this->composerJsonAttribute('extra.flarum-extension.icon'))) {
|
||||
if ($file = Arr::get($icon, 'image')) {
|
||||
$file = $this->path . '/' . $file;
|
||||
$file = $this->path.'/'.$file;
|
||||
|
||||
if (file_exists($file)) {
|
||||
$mimetype = pathinfo($file, PATHINFO_EXTENSION) === 'svg'
|
||||
? 'image/svg+xml'
|
||||
: finfo_file(finfo_open(FILEINFO_MIME_TYPE), $file);
|
||||
$data = file_get_contents($file);
|
||||
$data = file_get_contents($file);
|
||||
|
||||
$icon['backgroundImage'] = 'url(\'data:' . $mimetype . ';base64,' . base64_encode($data) . '\')';
|
||||
$icon['backgroundImage'] = 'url(\'data:'.$mimetype.';base64,'.base64_encode($data).'\')';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +193,7 @@ class Extension implements Arrayable
|
|||
}
|
||||
|
||||
/**
|
||||
* @param boolean $enabled
|
||||
* @param bool $enabled
|
||||
* @return Extension
|
||||
*/
|
||||
public function setEnabled($enabled)
|
||||
|
@ -205,7 +204,7 @@ class Extension implements Arrayable
|
|||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
|
@ -237,7 +236,7 @@ class Extension implements Arrayable
|
|||
*/
|
||||
public function hasAssets()
|
||||
{
|
||||
return realpath($this->path . '/assets/') !== false;
|
||||
return realpath($this->path.'/assets/') !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,7 +246,7 @@ class Extension implements Arrayable
|
|||
*/
|
||||
public function hasMigrations()
|
||||
{
|
||||
return realpath($this->path . '/migrations/') !== false;
|
||||
return realpath($this->path.'/migrations/') !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
namespace Flarum\Extension;
|
||||
|
||||
use Flarum\Core;
|
||||
use Flarum\Database\Migrator;
|
||||
use Flarum\Event\ExtensionWasDisabled;
|
||||
use Flarum\Event\ExtensionWasEnabled;
|
||||
|
@ -19,7 +18,6 @@ use Flarum\Foundation\Application;
|
|||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class ExtensionManager
|
||||
|
@ -47,9 +45,9 @@ class ExtensionManager
|
|||
Dispatcher $dispatcher,
|
||||
Filesystem $filesystem
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->app = $app;
|
||||
$this->migrator = $migrator;
|
||||
$this->config = $config;
|
||||
$this->app = $app;
|
||||
$this->migrator = $migrator;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->filesystem = $filesystem;
|
||||
}
|
||||
|
@ -61,15 +59,15 @@ class ExtensionManager
|
|||
{
|
||||
$extensionsDir = $this->getExtensionsDir();
|
||||
|
||||
$dirs = array_diff(scandir($extensionsDir), ['.', '..']);
|
||||
$dirs = array_diff(scandir($extensionsDir), ['.', '..']);
|
||||
$extensions = new Collection();
|
||||
|
||||
$installed = json_decode(file_get_contents(public_path('vendor/composer/installed.json')), true);
|
||||
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($manifest = $extensionsDir . '/' . $dir . '/composer.json')) {
|
||||
if (file_exists($manifest = $extensionsDir.'/'.$dir.'/composer.json')) {
|
||||
$extension = new Extension(
|
||||
$extensionsDir . '/' . $dir,
|
||||
$extensionsDir.'/'.$dir,
|
||||
json_decode(file_get_contents($manifest), true)
|
||||
);
|
||||
|
||||
|
@ -112,7 +110,7 @@ class ExtensionManager
|
|||
*/
|
||||
public function enable($name)
|
||||
{
|
||||
if (!$this->isEnabled($name)) {
|
||||
if (! $this->isEnabled($name)) {
|
||||
$extension = $this->getExtension($name);
|
||||
|
||||
$enabled = $this->getEnabled();
|
||||
|
@ -182,8 +180,8 @@ class ExtensionManager
|
|||
{
|
||||
if ($extension->hasAssets()) {
|
||||
$this->filesystem->copyDirectory(
|
||||
$extension->getPath() . '/assets',
|
||||
$this->app->basePath() . '/assets/extensions/' . $extension->getId()
|
||||
$extension->getPath().'/assets',
|
||||
$this->app->basePath().'/assets/extensions/'.$extension->getId()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +193,7 @@ class ExtensionManager
|
|||
*/
|
||||
protected function unpublishAssets(Extension $extension)
|
||||
{
|
||||
$this->filesystem->deleteDirectory($this->app->basePath() . '/assets/extensions/' . $extension);
|
||||
$this->filesystem->deleteDirectory($this->app->basePath().'/assets/extensions/'.$extension);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,7 +205,7 @@ class ExtensionManager
|
|||
*/
|
||||
public function getAsset(Extension $extension, $path)
|
||||
{
|
||||
return $this->app->basePath() . '/assets/extensions/' . $extension->getId() . $path;
|
||||
return $this->app->basePath().'/assets/extensions/'.$extension->getId().$path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -219,7 +217,7 @@ class ExtensionManager
|
|||
public function migrate(Extension $extension, $up = true)
|
||||
{
|
||||
if ($extension->hasMigrations()) {
|
||||
$migrationDir = $extension->getPath() . '/migrations';
|
||||
$migrationDir = $extension->getPath().'/migrations';
|
||||
|
||||
$this->app->bind('Illuminate\Database\Schema\Builder', function ($container) {
|
||||
return $container->make('Illuminate\Database\ConnectionInterface')->getSchemaBuilder();
|
||||
|
|
|
@ -146,7 +146,7 @@ class Formatter
|
|||
*/
|
||||
protected function getComponent($name)
|
||||
{
|
||||
$cacheKey = 'flarum.formatter.' . $name;
|
||||
$cacheKey = 'flarum.formatter.'.$name;
|
||||
|
||||
return $this->cache->rememberForever($cacheKey, function () use ($name) {
|
||||
return $this->getConfigurator()->finalize()[$name];
|
||||
|
|
|
@ -14,7 +14,6 @@ use Flarum\Forum\AuthenticationResponseFactory;
|
|||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Zend\Diactoros\Response\RedirectResponse;
|
||||
|
||||
abstract class AbstractOAuth2Controller implements ControllerInterface
|
||||
|
|
|
@ -10,9 +10,8 @@
|
|||
|
||||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Core\Exception\PermissionDeniedException;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class AuthorizedClientController extends ClientController
|
||||
{
|
||||
|
@ -21,7 +20,7 @@ class AuthorizedClientController extends ClientController
|
|||
*/
|
||||
public function render(Request $request)
|
||||
{
|
||||
if (!$request->getAttribute('session')->get('user_id')) {
|
||||
if (! $request->getAttribute('session')->get('user_id')) {
|
||||
throw new PermissionDeniedException;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ namespace Flarum\Forum\Controller;
|
|||
use Flarum\Api\Client;
|
||||
use Flarum\Formatter\Formatter;
|
||||
use Flarum\Foundation\Application;
|
||||
use Flarum\Http\Controller\AbstractClientController;
|
||||
use Flarum\Locale\LocaleManager;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\Http\Controller\AbstractClientController;
|
||||
use Illuminate\Contracts\Cache\Repository;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
|
@ -55,7 +55,7 @@ class ClientController extends AbstractClientController
|
|||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getAssets()
|
||||
{
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Http\Exception\RouteNotFoundException;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class DiscussionController extends ClientController
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ class DiscussionController extends ClientController
|
|||
$queryString = http_build_query($newQueryParams);
|
||||
|
||||
return app('Flarum\Forum\UrlGenerator')
|
||||
->toRoute('discussion', ['id' => $document->data->id]) .
|
||||
->toRoute('discussion', ['id' => $document->data->id]).
|
||||
($queryString ? '?'.$queryString : '');
|
||||
};
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Flarum\Forum\Controller;
|
|||
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Api\Controller\TokenController;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Event\UserLoggedIn;
|
||||
use Flarum\Core\Repository\UserRepository;
|
||||
use Flarum\Event\UserLoggedIn;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Http\Rememberer;
|
||||
use Flarum\Http\SessionAuthenticator;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Http\Rememberer;
|
||||
use Flarum\Http\SessionAuthenticator;
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use DateTime;
|
||||
use Flarum\Core\Exception\InvalidConfirmationTokenException;
|
||||
use Flarum\Core\PasswordToken;
|
||||
use Flarum\Http\Controller\AbstractHtmlController;
|
||||
use Flarum\Core\Exception\InvalidConfirmationTokenException;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use DateTime;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class ResetPasswordController extends AbstractHtmlController
|
||||
{
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
namespace Flarum\Forum\Controller;
|
||||
|
||||
use Flarum\Core\PasswordToken;
|
||||
use Flarum\Core\Command\EditUser;
|
||||
use Flarum\Forum\UrlGenerator;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Http\SessionAuthenticator;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
namespace Flarum\Foundation;
|
||||
|
||||
use Flarum\Core;
|
||||
use Illuminate\Config\Repository as ConfigRepository;
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
|
@ -165,7 +164,7 @@ abstract class AbstractServer
|
|||
protected function registerLogger(Application $app)
|
||||
{
|
||||
$logger = new Logger($app->environment());
|
||||
$logPath = $app->storagePath() . '/logs/flarum.log';
|
||||
$logPath = $app->storagePath().'/logs/flarum.log';
|
||||
|
||||
$handler = new StreamHandler($logPath, Logger::DEBUG);
|
||||
$handler->setFormatter(new LineFormatter(null, null, true, true));
|
||||
|
|
|
@ -163,7 +163,7 @@ class Application extends Container implements ApplicationContract
|
|||
}
|
||||
|
||||
if ($path) {
|
||||
$url .= '/' . array_get($config, "paths.$path", $path);
|
||||
$url .= '/'.array_get($config, "paths.$path", $path);
|
||||
}
|
||||
|
||||
return $url;
|
||||
|
|
|
@ -52,7 +52,7 @@ class AbstractUrlGenerator
|
|||
$path = $this->routes->getPath($name, $parameters);
|
||||
$path = ltrim($path, '/');
|
||||
|
||||
return $this->toBase() . '/' . $path;
|
||||
return $this->toBase().'/'.$path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,7 +63,7 @@ class AbstractUrlGenerator
|
|||
*/
|
||||
public function toPath($path)
|
||||
{
|
||||
return $this->toBase() . '/' . $path;
|
||||
return $this->toBase().'/'.$path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,6 @@ use Flarum\Api\Client;
|
|||
use Flarum\Asset\AssetManager;
|
||||
use Flarum\Asset\JsCompiler;
|
||||
use Flarum\Asset\LessCompiler;
|
||||
use Flarum\Core;
|
||||
use Flarum\Event\ConfigureClientView;
|
||||
use Flarum\Foundation\Application;
|
||||
use Flarum\Locale\JsCompiler as LocaleJsCompiler;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
namespace Flarum\Http\Controller;
|
||||
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response;
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ namespace Flarum\Http\Controller;
|
|||
use Flarum\Api\Client;
|
||||
use Flarum\Asset\AssetManager;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Locale\JsCompiler;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Locale\JsCompiler;
|
||||
|
||||
/**
|
||||
* This class represents a view which boots up Flarum's client.
|
||||
|
@ -255,7 +255,7 @@ class ClientView implements Renderable
|
|||
|
||||
$noJs = array_get($this->request->getQueryParams(), 'nojs');
|
||||
|
||||
$view->title = ($this->title ? $this->title . ' - ' : '') . $forum->data->attributes->title;
|
||||
$view->title = ($this->title ? $this->title.' - ' : '').$forum->data->attributes->title;
|
||||
$view->forum = $forum->data;
|
||||
$view->layout = app('view')->file($this->layout, [
|
||||
'forum' => $forum->data,
|
||||
|
|
|
@ -27,7 +27,7 @@ trait GenerateRouteHandlerTrait
|
|||
|
||||
if (! ($controller instanceof ControllerInterface)) {
|
||||
throw new \InvalidArgumentException('Route handler must be an instance of '
|
||||
. ControllerInterface::class);
|
||||
.ControllerInterface::class);
|
||||
}
|
||||
|
||||
$request = $request->withQueryParams(array_merge($request->getQueryParams(), $routeParams));
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
namespace Flarum\Http\Middleware;
|
||||
|
||||
use DateTime;
|
||||
use Flarum\Api\ApiKey;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Http\AccessToken;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
namespace Flarum\Http\Middleware;
|
||||
|
||||
use FastRoute\Dispatcher;
|
||||
use FastRoute\RouteParser;
|
||||
use Flarum\Http\Exception\MethodNotAllowedException;
|
||||
use Flarum\Http\Exception\RouteNotFoundException;
|
||||
use Flarum\Http\RouteCollection;
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
namespace Flarum\Http\Middleware;
|
||||
|
||||
use Franzl\Middleware\Whoops\ErrorMiddleware as WhoopsMiddleware;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Zend\Stratigility\ErrorMiddlewareInterface;
|
||||
use Franzl\Middleware\Whoops\ErrorMiddleware as WhoopsMiddleware;
|
||||
|
||||
class HandleErrors implements ErrorMiddlewareInterface
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@ class RouteCollection
|
|||
$parts = $this->reverse[$name][0];
|
||||
array_walk($parts, [$this, 'fixPathPart'], $parameters);
|
||||
|
||||
return '/' . ltrim(implode('', $parts), '/');
|
||||
return '/'.ltrim(implode('', $parts), '/');
|
||||
}
|
||||
|
||||
throw new \RuntimeException("Route $name not found");
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace Flarum\Install\Console;
|
||||
|
||||
use Exception;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Exception;
|
||||
|
||||
class FileDataProvider implements DataProviderInterface
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ class FileDataProvider implements DataProviderInterface
|
|||
$this->baseUrl = isset($configuration['baseUrl']) ? rtrim($configuration['baseUrl'], '/') : null;
|
||||
$this->databaseConfiguration = isset($configuration['databaseConfiguration']) ? $configuration['databaseConfiguration'] : [];
|
||||
$this->adminUser = isset($configuration['adminUser']) ? $configuration['adminUser'] : [];
|
||||
$this->settings = isset($configuration['settings']) ? $configuration['settings']: [];
|
||||
$this->settings = isset($configuration['settings']) ? $configuration['settings'] : [];
|
||||
} else {
|
||||
throw new Exception('Configuration file does not exist.');
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class FileDataProvider implements DataProviderInterface
|
|||
|
||||
public function getBaseUrl()
|
||||
{
|
||||
return (!is_null($this->baseUrl)) ? $this->baseUrl : $this->default->getBaseUrl();
|
||||
return (! is_null($this->baseUrl)) ? $this->baseUrl : $this->default->getBaseUrl();
|
||||
}
|
||||
|
||||
public function getAdminUser()
|
||||
|
|
|
@ -10,21 +10,17 @@
|
|||
|
||||
namespace Flarum\Install\Console;
|
||||
|
||||
use Exception;
|
||||
use Flarum\Console\Command\AbstractCommand;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Core\Group;
|
||||
use Flarum\Core\Permission;
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Validation\Factory;
|
||||
use PDO;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Exception;
|
||||
|
||||
class InstallCommand extends AbstractCommand
|
||||
{
|
||||
|
@ -77,7 +73,7 @@ class InstallCommand extends AbstractCommand
|
|||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function fire()
|
||||
{
|
||||
|
@ -238,7 +234,7 @@ class InstallCommand extends AbstractCommand
|
|||
$migrator = $this->application->make('Flarum\Database\Migrator');
|
||||
$migrator->getRepository()->createRepository();
|
||||
|
||||
$migrator->run(__DIR__ . '/../../../migrations');
|
||||
$migrator->run(__DIR__.'/../../../migrations');
|
||||
|
||||
foreach ($migrator->getNotes() as $note) {
|
||||
$this->info($note);
|
||||
|
@ -393,7 +389,7 @@ class InstallCommand extends AbstractCommand
|
|||
$this->info($error['message']);
|
||||
|
||||
if (isset($error['detail'])) {
|
||||
$this->output->writeln('<comment>' . $error['detail'] . '</comment>');
|
||||
$this->output->writeln('<comment>'.$error['detail'].'</comment>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
namespace Flarum\Install\Console;
|
||||
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
@ -26,7 +25,6 @@ class UserDataProvider implements DataProviderInterface
|
|||
|
||||
protected $baseUrl;
|
||||
|
||||
|
||||
public function __construct(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper)
|
||||
{
|
||||
$this->input = $input;
|
||||
|
@ -77,13 +75,13 @@ class UserDataProvider implements DataProviderInterface
|
|||
'forum_title' => $title,
|
||||
'forum_description' => '',
|
||||
'mail_driver' => 'mail',
|
||||
'mail_from' => 'noreply@' . preg_replace('/^www\./i', '', parse_url($baseUrl, PHP_URL_HOST)),
|
||||
'mail_from' => 'noreply@'.preg_replace('/^www\./i', '', parse_url($baseUrl, PHP_URL_HOST)),
|
||||
'theme_colored_header' => '0',
|
||||
'theme_dark_mode' => '0',
|
||||
'theme_primary_color' => '#4D698E',
|
||||
'theme_secondary_color' => '#4D698E',
|
||||
'welcome_message' => 'This is beta software and you should not use it in production.',
|
||||
'welcome_title' => 'Welcome to ' . $title,
|
||||
'welcome_title' => 'Welcome to '.$title,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
namespace Flarum\Install\Controller;
|
||||
|
||||
use Flarum\Install\Prerequisite\PrerequisiteInterface;
|
||||
use Flarum\Http\Controller\AbstractHtmlController;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Install\Prerequisite\PrerequisiteInterface;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class IndexController extends AbstractHtmlController
|
||||
{
|
||||
|
|
|
@ -10,19 +10,16 @@
|
|||
|
||||
namespace Flarum\Install\Controller;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Http\SessionAuthenticator;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Zend\Diactoros\Response;
|
||||
use Flarum\Install\Console\InstallCommand;
|
||||
use Flarum\Install\Console\DefaultsDataProvider;
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
use Exception;
|
||||
use DateTime;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Http\SessionAuthenticator;
|
||||
use Flarum\Install\Console\DefaultsDataProvider;
|
||||
use Flarum\Install\Console\InstallCommand;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
use Zend\Diactoros\Response;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
|
||||
class InstallController implements ControllerInterface
|
||||
{
|
||||
|
@ -74,8 +71,8 @@ class InstallController implements ControllerInterface
|
|||
$data->setBaseUrl($baseUrl);
|
||||
|
||||
$data->setSetting('forum_title', array_get($input, 'forumTitle'));
|
||||
$data->setSetting('mail_from', 'noreply@' . preg_replace('/^www\./i', '', parse_url($baseUrl, PHP_URL_HOST)));
|
||||
$data->setSetting('welcome_title', 'Welcome to ' . array_get($input, 'forumTitle'));
|
||||
$data->setSetting('mail_from', 'noreply@'.preg_replace('/^www\./i', '', parse_url($baseUrl, PHP_URL_HOST)));
|
||||
$data->setSetting('welcome_title', 'Welcome to '.array_get($input, 'forumTitle'));
|
||||
|
||||
$body = fopen('php://temp', 'wb+');
|
||||
$input = new StringInput('');
|
||||
|
|
|
@ -32,9 +32,9 @@ class JsCompiler extends BaseJsCompiler
|
|||
$output .= file_get_contents($filename);
|
||||
}
|
||||
|
||||
$output .= "}
|
||||
$output .= '}
|
||||
};
|
||||
});";
|
||||
});';
|
||||
|
||||
return $this->format($output);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class Translator extends BaseTranslator
|
|||
$this->assertValidLocale($locale);
|
||||
}
|
||||
|
||||
$parse = !isset($this->catalogues[$locale]);
|
||||
$parse = ! isset($this->catalogues[$locale]);
|
||||
|
||||
$catalogue = parent::getCatalogue($locale);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class MemoryCacheSettingsRepository implements SettingsRepositoryInterface
|
|||
|
||||
public function all()
|
||||
{
|
||||
if (!$this->isCached) {
|
||||
if (! $this->isCached) {
|
||||
$this->cache = $this->inner->all();
|
||||
$this->isCached = true;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class MemoryCacheSettingsRepository implements SettingsRepositoryInterface
|
|||
{
|
||||
if (array_key_exists($key, $this->cache)) {
|
||||
return $this->cache[$key];
|
||||
} elseif (!$this->isCached) {
|
||||
} elseif (! $this->isCached) {
|
||||
return array_get($this->all(), $key, $default);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,6 @@ namespace Flarum\Update\Console;
|
|||
|
||||
use Flarum\Console\Command\AbstractCommand;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class MigrateCommand extends AbstractCommand
|
||||
{
|
||||
|
@ -41,7 +37,7 @@ class MigrateCommand extends AbstractCommand
|
|||
{
|
||||
$this
|
||||
->setName('migrate')
|
||||
->setDescription("Run outstanding migrations.");
|
||||
->setDescription('Run outstanding migrations.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
namespace Flarum\Update\Controller;
|
||||
|
||||
use Flarum\Http\Controller\AbstractHtmlController;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class IndexController extends AbstractHtmlController
|
||||
{
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Tests\Flarum\Core\Settings;
|
||||
|
||||
use Flarum\Settings\DatabaseSettingsRepository;
|
||||
|
@ -16,17 +26,17 @@ class DatabaseSettingsRepositoryTest extends TestCase
|
|||
$this->connection = m::mock(ConnectionInterface::class);
|
||||
$this->repository = new DatabaseSettingsRepository($this->connection);
|
||||
}
|
||||
|
||||
|
||||
public function test_requesting_an_existing_setting_should_return_its_value()
|
||||
{
|
||||
$this->connection->shouldReceive("table->where->value")->andReturn('value');
|
||||
$this->connection->shouldReceive('table->where->value')->andReturn('value');
|
||||
|
||||
$this->assertEquals('value', $this->repository->get('key'));
|
||||
}
|
||||
|
||||
public function test_non_existent_setting_values_should_return_null()
|
||||
{
|
||||
$this->connection->shouldReceive("table->where->value")->andReturn(null);
|
||||
$this->connection->shouldReceive('table->where->value')->andReturn(null);
|
||||
|
||||
$this->assertEquals('default', $this->repository->get('key', 'default'));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Tests\Flarum\Core\Settings;
|
||||
|
||||
use Flarum\Settings\MemoryCacheSettingsRepository;
|
||||
|
@ -16,7 +26,7 @@ class MemoryCacheSettingsRepositoryTest extends TestCase
|
|||
$this->baseRepository = m::mock(SettingsRepositoryInterface::class);
|
||||
$this->repository = new MemoryCacheSettingsRepository($this->baseRepository);
|
||||
}
|
||||
|
||||
|
||||
public function test_it_should_return_all_settings_when_not_cached()
|
||||
{
|
||||
$this->baseRepository->shouldReceive('all')->once()->andReturn(['key' => 'value']);
|
||||
|
@ -32,7 +42,7 @@ class MemoryCacheSettingsRepositoryTest extends TestCase
|
|||
$this->assertEquals('value2', $this->repository->get('key2'));
|
||||
$this->assertEquals('value2', $this->repository->get('key2')); // Assert twice to ensure we hit the cache
|
||||
}
|
||||
|
||||
|
||||
public function test_it_should_set_a_key_value_pair()
|
||||
{
|
||||
$this->baseRepository->shouldReceive('set')->once();
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Tests\Test;
|
||||
|
||||
use Mockery;
|
||||
|
|
|
@ -162,7 +162,7 @@
|
|||
<body>
|
||||
<div class="container">
|
||||
<h1>
|
||||
<?php echo file_get_contents(__DIR__ . '/logo.svg'); ?>
|
||||
<?php echo file_get_contents(__DIR__.'/logo.svg'); ?>
|
||||
</h1>
|
||||
|
||||
<div class="animated fadeIn">
|
||||
|
|
Loading…
Reference in New Issue
Block a user