Connection   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 21
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApiSkeletons\Doctrine\GraphQL\Type;
6
7
use ApiSkeletons\Doctrine\GraphQL\AbstractContainer;
8
use ApiSkeletons\Doctrine\GraphQL\Buildable;
9
use GraphQL\Type\Definition\ObjectType;
10
use GraphQL\Type\Definition\Type;
11
12
use function assert;
13
14
/**
15
 * This type is built within the TypeManager
16
 */
17
class Connection extends ObjectType implements
18
    Buildable
19
{
20
    /** @param mixed[] $params */
21
    public function __construct(AbstractContainer $container, string $typeName, array $params)
22
    {
23
        assert($params[0] instanceof ObjectType);
24
        $objectType = $params[0];
25
26
        $configuration = [
27
            'name' => $typeName,
28
            'description' => 'Connection for ' . $typeName,
29
            'fields' => [
30
                'edges' => Type::listOf($container
31
                    ->build(Node::class, $typeName . '_Node', $objectType)),
32
                'totalCount' => Type::nonNull(Type::int()),
33
                'pageInfo' => $container->get('PageInfo'),
34
            ],
35
        ];
36
37
        parent::__construct($configuration);
38
    }
39
}
40