Completed
Pull Request — master (#13)
by Rafael
06:46
created

UnionTypeDefinition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 17
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Definition;
12
13
use Ynlo\GraphQLBundle\Definition\Traits\ClassAwareDefinitionTrait;
14
use Ynlo\GraphQLBundle\Definition\Traits\TypeAwareDefinitionTrait;
15
use Ynlo\GraphQLBundle\Util\TypeUtil;
16
17
/**
18
 * UnionTypeDefinition
19
 */
20
class UnionTypeDefinition implements TypeAwareDefinitionInterface, ClassAwareDefinitionInterface
21
{
22
    use TypeAwareDefinitionTrait;
23
    use ClassAwareDefinitionTrait;
24
25
    /**
26
     * UnionTypeDefinition constructor.
27
     *
28
     * @param string|null $type
29
     */
30
    public function __construct(string $type = null)
31
    {
32
        if ($type) {
33
            $this->type = TypeUtil::normalize($type);
34
            $this->list = TypeUtil::isTypeList($type);
35
            $this->nonNull = TypeUtil::isTypeNonNull($type);
36
            $this->nonNullList = TypeUtil::isTypeNonNullList($type);
37
        }
38
    }
39
}
40