PageInfo   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
eloc 18
c 2
b 0
f 0
dl 0
loc 35
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 33 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApiSkeletons\Doctrine\GraphQL\Type;
6
7
use GraphQL\Type\Definition\ObjectType;
8
use GraphQL\Type\Definition\Type;
9
10
class PageInfo extends ObjectType
11
{
12
    public function __construct()
13
    {
14
        $configuration = [
15
            /**
16
             * Because you may create multiple drivers and assign types to the
17
             * schema from each, there would be a name collision if this object
18
             * used only the name `PageInfo` as defined in section 2.1.2 of the
19
             * GraphQL spec:ification.
20
             * https://relay.dev/graphql/connections.htm#sec-Connection-Types.Fields.PageInfo
21
             */
22
            'name' => 'PageInfo',
23
            'description' => 'Page information',
24
            'fields' => [
25
                'startCursor' => [
26
                    'description' => 'Cursor corresponding to the first node in edges.',
27
                    'type' => Type::nonNull(Type::string()),
28
                ],
29
                'endCursor' => [
30
                    'description' => 'Cursor corresponding to the last node in edges.',
31
                    'type' => Type::nonNull(Type::string()),
32
                ],
33
                'hasPreviousPage' => [
34
                    'description' => 'If edges contains more than last elements return true, otherwise false.',
35
                    'type' => Type::nonNull(Type::boolean()),
36
                ],
37
                'hasNextPage' => [
38
                    'description' => 'If edges contains more than first elements return true, otherwise false.',
39
                    'type' => Type::nonNull(Type::boolean()),
40
                ],
41
            ],
42
        ];
43
44
        parent::__construct($configuration);
45
    }
46
}
47