NonNullType::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3.072

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 5
cp 0.8
rs 9.4285
cc 3
eloc 4
nc 2
nop 2
crap 3.072
1
<?php
2
3
namespace Fubhy\GraphQL\Language\Node;
4
5
use Fubhy\GraphQL\Language\Location;
6
use Fubhy\GraphQL\Language\Node;
7
8
class NonNullType extends Node implements TypeInterface
9
{
10
    const KIND = Node::KIND_NON_NULL_TYPE;
11
12
    /**
13
     * Constructor.
14
     *
15
     * @param \Fubhy\GraphQL\Language\Node\TypeInterface $type
16
     * @param \Fubhy\GraphQL\Language\Location $location
17
     */
18 45
    public function __construct(TypeInterface $type, Location $location = NULL)
19
    {
20 45
        if (!($type instanceof NamedType || $type instanceof ListType)) {
21
            throw new \InvalidArgumentException(sprintf('Invalid type %s.', get_class($type)));
22
        }
23
24 45
        parent::__construct($location, ['type' => $type]);
25 45
    }
26
}
27