UserType::typeFields()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

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