Completed
Push — 2.0 ( d39b3c...f2914f )
by Kirill
02:52
created

UserType   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B typeFields() 0 25 1
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\Types;
11
12
use GraphQL\Type\Definition\Type;
13
14
/**
15
 * Class UserType.
16
 */
17
class UserType extends AbstractType
18
{
19
    /**
20
     * @var array
21
     */
22
    protected $attributes = [
23
        'name'        => 'User',
24
        'description' => 'User object',
25
    ];
26
27
    /**
28
     * @return array
29
     */
30
    public function typeFields(): array
31
    {
32
        return [
33
            'id'           => [
34
                'type'        => Type::nonNull(Type::id()),
35
                'description' => 'User identifier',
36
            ],
37
            'name'         => [
38
                'type'        => Type::nonNull(Type::string()),
39
                'description' => 'User name',
40
            ],
41
            'avatar'       => [
42
                'type'        => Type::nonNull(Type::string()),
43
                'description' => 'User avatar url',
44
            ],
45
            'token'        => [
46
                'type'        => Type::string(),
47
                'description' => 'User secret auth token',
48
            ],
49
            'is_confirmed' => [
50
                'type'        => Type::nonNull(Type::boolean()),
51
                'description' => 'User confirmation status',
52
            ],
53
        ];
54
    }
55
}
56