Code Duplication    Length = 39-39 lines in 2 locations

server/app/GraphQL/Types/SearchResultType.php 1 location

@@ 17-55 (lines=39) @@
14
 * Class SearchResultType
15
 * @package App\GraphQL\Types
16
 */
17
class SearchResultType extends AbstractType
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
}

server/app/GraphQL/Types/UserType.php 1 location

@@ 18-56 (lines=39) @@
15
/**
16
 * Class UserType.
17
 */
18
class UserType extends AbstractType
19
{
20
    /**
21
     * @var array
22
     */
23
    protected $attributes = [
24
        'name'        => 'User',
25
        'description' => 'User object',
26
    ];
27
28
    /**
29
     * @return array
30
     */
31
    public function fields(): array
32
    {
33
        return [
34
            'id'           => [
35
                'type'        => Type::nonNull(Type::id()),
36
                'description' => 'User identifier',
37
            ],
38
            'name'         => [
39
                'type'        => Type::nonNull(Type::string()),
40
                'description' => 'User name',
41
            ],
42
            'email'        => [
43
                'type'        => Type::nonNull(Type::string()),
44
                'description' => 'User email',
45
            ],
46
            'avatar'       => [
47
                'type'        => Type::nonNull(Type::string()),
48
                'description' => 'User avatar url',
49
            ],
50
            'is_confirmed' => [
51
                'type'        => Type::nonNull(Type::boolean()),
52
                'description' => 'User confirmation status',
53
            ],
54
        ];
55
    }
56
}
57