Test Failed
Push — feature-laravel-5.4 ( 6f3b9a...66d75b )
by Kirill
03:40
created

TipsQuery::queryArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 4
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of laravel.su package.
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace App\GraphQL\Queries;
11
12
use App\Models\Tip;
13
use App\GraphQL\Types\TipType;
14
use GraphQL\Type\Definition\Type;
15
use Illuminate\Support\Collection;
16
use Illuminate\Database\Query\Builder;
17
use GraphQL\Type\Definition\ListOfType;
18
use App\GraphQL\Serializers\TipSerializer;
19
20
/**
21
 * Class TipsQuery.
22
 */
23 View Code Duplication
class TipsQuery extends AbstractQuery
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
{
25
    /**
26
     * @var array
27
     */
28
    protected $attributes = [
29
        'name'        => 'Tips list query',
30
        'description' => 'Returns a list of available tips',
31
    ];
32
33
    /**
34
     * @return ListOfType
35
     */
36
    public function type(): ListOfType
37
    {
38
        return Type::listOf(\GraphQL::type(TipType::getName()));
39
    }
40
41
    /**
42
     * @return array
43
     */
44
    protected function queryArguments(): array
45
    {
46
        return [];
47
    }
48
49
    /**
50
     * @param             $root
51
     * @param  array      $args
52
     * @return Collection
53
     */
54
    public function resolve($root, array $args = []): Collection
0 ignored issues
show
Unused Code introduced by
The parameter $root is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
    {
56
        /** @var Builder $query */
57
        $query = $this->queryFor(Tip::class, $args)
58
            ->with('likes', 'dislikes', 'user');
59
60
        return TipSerializer::collection($query->get());
61
    }
62
}
63