Merge pull request #27 from flarum/analysis-8wjM79

Applied fixes from StyleCI
This commit is contained in:
Toby Zerner 2016-02-26 14:28:19 +10:30
commit 1d697a6318
25 changed files with 63 additions and 42 deletions

View File

@ -23,7 +23,6 @@ use Illuminate\Database\Query\Expression;
class DiscussionPolicy extends AbstractPolicy
{
/**
* {@inheritdoc}
*/
@ -73,7 +72,7 @@ class DiscussionPolicy extends AbstractPolicy
foreach ($tags as $tag) {
if ($tag->is_restricted) {
if ($actor->hasPermission('tag' . $tag->id . '.discussion.' . $ability)) {
if ($actor->hasPermission('tag'.$tag->id.'.discussion.'.$ability)) {
return true;
}
} else {

View File

@ -39,7 +39,7 @@ class TagPolicy extends AbstractPolicy
public function startDiscussion(User $actor, Tag $tag)
{
if ((! $tag->is_restricted && $actor->hasPermission('startDiscussion'))
|| $actor->hasPermission('tag' . $tag->id . '.startDiscussion')) {
|| $actor->hasPermission('tag'.$tag->id.'.startDiscussion')) {
return true;
}
}

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*
@ -20,7 +21,7 @@ use Tobscure\JsonApi\Document;
class CreateTagController extends AbstractCreateController
{
/**
* @inheritdoc
* {@inheritdoc}
*/
public $serializer = TagSerializer::class;

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*
@ -20,7 +21,7 @@ use Tobscure\JsonApi\Document;
class UpdateTagController extends AbstractResourceController
{
/**
* @inheritdoc
* {@inheritdoc}
*/
public $serializer = TagSerializer::class;

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*
@ -54,7 +55,7 @@ class TagSerializer extends AbstractSerializer
*/
protected function parent($tag)
{
return $this->hasOne($tag, TagSerializer::class);
return $this->hasOne($tag, self::class);
}
/**

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*
@ -10,8 +11,8 @@
namespace Flarum\Tags\Listener;
use Flarum\Tags\Api\Controller;
use Flarum\Event\ConfigureApiRoutes;
use Flarum\Tags\Api\Controller;
use Illuminate\Contracts\Events\Dispatcher;
class AddTagsApi

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*
@ -51,8 +52,8 @@ class DiscussionTaggedPost extends AbstractEventPost implements MergeableInterfa
/**
* Create a new instance in reply to a discussion.
*
* @param integer $discussionId
* @param integer $userId
* @param int $discussionId
* @param int $userId
* @param array $oldTagIds
* @param array $newTagIds
* @return static
@ -61,10 +62,10 @@ class DiscussionTaggedPost extends AbstractEventPost implements MergeableInterfa
{
$post = new static;
$post->content = static::buildContent($oldTagIds, $newTagIds);
$post->time = time();
$post->content = static::buildContent($oldTagIds, $newTagIds);
$post->time = time();
$post->discussion_id = $discussionId;
$post->user_id = $userId;
$post->user_id = $userId;
return $post;
}

View File

@ -57,11 +57,11 @@ class Tag extends AbstractModel
{
$tag = new static;
$tag->name = $name;
$tag->slug = $slug;
$tag->name = $name;
$tag->slug = $slug;
$tag->description = $description;
$tag->color = $color;
$tag->is_hidden = (bool) $isHidden;
$tag->color = $color;
$tag->is_hidden = (bool) $isHidden;
return $tag;
}
@ -112,7 +112,7 @@ class Tag extends AbstractModel
*/
public function setLastDiscussion(Discussion $discussion)
{
$this->last_time = $discussion->last_time;
$this->last_time = $discussion->last_time;
$this->last_discussion_id = $discussion->id;
return $this;
@ -135,7 +135,7 @@ class Tag extends AbstractModel
$hasGlobalPermission = $user->hasPermission($permission);
foreach ($tags as $tag) {
if (($hasGlobalPermission && ! $tag->is_restricted) || $user->hasPermission('tag' . $tag->id . '.' . $permission)) {
if (($hasGlobalPermission && ! $tag->is_restricted) || $user->hasPermission('tag'.$tag->id.'.'.$permission)) {
$ids[] = $tag->id;
}
}
@ -160,7 +160,7 @@ class Tag extends AbstractModel
$hasGlobalPermission = $user->hasPermission($permission);
foreach ($tags as $tag) {
if (($tag->is_restricted || ! $hasGlobalPermission) && ! $user->hasPermission('tag' . $tag->id . '.' . $permission)) {
if (($tag->is_restricted || ! $hasGlobalPermission) && ! $user->hasPermission('tag'.$tag->id.'.'.$permission)) {
$ids[] = $tag->id;
}
}

View File

@ -1,4 +1,5 @@
<?php
<?php
/*
* This file is part of Flarum.
*
@ -50,7 +51,7 @@ class TagRepository
*
* @param string $slug
* @param User|null $user
* @return integer
* @return int
*/
public function getIdForSlug($slug, User $user = null)
{