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

SearchResultType::fields()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 17

Duplication

Lines 25
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 17
nc 1
nop 0
dl 25
loc 25
rs 8.8571
c 0
b 0
f 0
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
}