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

ArticleType   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A typeFields() 0 57 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 App\Models\Article;
13
use GraphQL\Type\Definition\Type;
14
use App\GraphQL\Kernel\EnumTransfer;
15
16
/**
17
 * Class ArticleType.
18
 */
19
class ArticleType extends AbstractType
20
{
21
    /**
22
     * @var array
23
     */
24
    protected $attributes = [
25
        'name'        => 'Article',
26
        'description' => 'Article object',
27
    ];
28
29
    /**
30
     * @return array
31
     */
32
    public function typeFields(): array
33
    {
34
        return [
35
            'id'             => [
36
                'type'        => Type::nonNull(Type::id()),
37
                'description' => 'Article identifier',
38
            ],
39
            'title'          => [
40
                'type'        => Type::nonNull(Type::string()),
41
                'description' => 'Article title',
42
            ],
43
            'slug'           => [
44
                'type'        => Type::string(),
45
                'description' => 'Article slug (part of url)',
46
            ],
47
            'url'            => [
48
                'type'        => Type::string(),
49
                'description' => 'Article url',
50
            ],
51
            'image'          => [
52
                'type'        => Type::nonNull(Type::string()),
53
                'description' => 'Article preview image',
54
            ],
55
            'content'        => [
56
                'type'        => Type::nonNull(Type::string()),
57
                'description' => 'Article rendered content',
58
            ],
59
            'content_source' => [
60
                'type'        => Type::nonNull(Type::string()),
61
                'description' => 'Article content source (original)',
62
            ],
63
            'preview'        => [
64
                'type'        => Type::string(),
65
                'description' => 'Article content preview',
66
            ],
67
            'preview_source' => [
68
                'type'        => Type::string(),
69
                'description' => 'Article content preview (original)',
70
            ],
71
            'status'         => [
72
                'type'        => Article\Status::class,
73
                'description' => 'Article status',
74
            ],
75
            'published_at'   => [
76
                'type'        => Type::string(),
77
                'description' => 'Article publishing date and time in RFC3339 format',
78
            ],
79
            'user'           => [
80
                'type'        => \GraphQL::type('User'),
81
                'description' => 'Article author relation',
82
            ],
83
            'tags'           => [
84
                'type'        => Type::listOf(\GraphQL::type('Tag')),
85
                'description' => 'Article tags',
86
            ],
87
        ];
88
    }
89
}
90