Completed
Push — 2.0 ( 82d9cb...93098a )
by Kirill
05:32
created

SearchResultType   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 39
loc 39
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
B fields() 25 25 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * This file is part of laravel.ru package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace App\GraphQL\Types;
10
11
use GraphQL\Type\Definition\Type;
12
13
/**
14
 * Class SearchResultType
15
 * @package App\GraphQL\Types
16
 */
17 View Code Duplication
class SearchResultType extends AbstractType
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...
18
{
19
    /**
20
     * @var array
21
     */
22
    protected $attributes = [
23
        'name'        => 'Serach result type',
24
        'description' => 'Type for search results',
25
    ];
26
27
    /**
28
     * @return array
29
     */
30
    public function fields(): array
31
    {
32
        return [
33
            'slug'   => [
34
                'type'        => Type::nonNull(Type::string()),
35
                'description' => '',
36
            ],
37
            'url'   => [
38
                'type'        => Type::nonNull(Type::string()),
39
                'description' => '',
40
            ],
41
            'content' => [
42
                'type'        => Type::nonNull(Type::string()),
43
                'description' => '',
44
            ],
45
            'title'   => [
46
                'type'        => Type::string(),
47
                'description' => '',
48
            ],
49
            'type'    => [
50
                'type'        => Type::string(),
51
                'description' => 'Related to articles, docs_pages, docs or more',
52
            ],
53
        ];
54
    }
55
}