Completed
Push — master ( 600f67...159739 )
by Alexandr
05:28
created

PageInfoType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 5
dl 0
loc 30
ccs 13
cts 13
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 21 1
A getDescription() 0 4 1
1
<?php
2
/**
3
 * This file is a part of GraphQL project.
4
 *
5
 * @author Alexandr Viniychuk <[email protected]>
6
 * created: 2/23/17 4:19 PM
7
 */
8
9
namespace Youshido\GraphQL\Relay\Type;
10
11
12
use Youshido\GraphQL\Config\Object\ObjectTypeConfig;
13
use Youshido\GraphQL\Type\NonNullType;
14
use Youshido\GraphQL\Type\Object\AbstractObjectType;
15
use Youshido\GraphQL\Type\Scalar\BooleanType;
16
use Youshido\GraphQL\Type\Scalar\StringType;
17
18
class PageInfoType extends AbstractObjectType
19
{
20 1
    public function build($config)
21
    {
22 1
        $config->addFields([
23
            'hasNextPage'     => [
24 1
                'type'        => new NonNullType(new BooleanType()),
25 1
                'description' => 'When paginating forwards, are there more items?'
26
            ],
27
            'hasPreviousPage' => [
28 1
                'type'        => new NonNullType(new BooleanType()),
29 1
                'description' => 'When paginating backwards, are there more items?'
30
            ],
31
            'startCursor'     => [
32 1
                'type'        => new StringType(),
33 1
                'description' => 'When paginating backwards, the cursor to continue.'
34
            ],
35
            'endCursor'       => [
36 1
                'type'        => new StringType(),
37 1
                'description' => 'When paginating forwards, the cursor to continue.'
38
            ],
39
        ]);
40 1
    }
41
42 1
    public function getDescription()
43
    {
44 1
        return "Information about pagination in a connection.";
45
    }
46
47
}