Test Failed
Push — master ( da2c9c...d0cc4d )
by Kirill
02:03
created

FieldDefinition::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 4
crap 2
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\Reflection\Definition\Dependent;
11
12
use Railt\Reflection\Contracts\Definition\Dependent\FieldDefinition as FieldDefinitionInterface;
13
use Railt\Reflection\Contracts\Definition\TypeDefinition;
14
use Railt\Reflection\Contracts\Type as TypeInterface;
15
use Railt\Reflection\Definition\Behaviour\HasArguments;
16
use Railt\Reflection\Definition\Behaviour\HasTypeIndication;
17
use Railt\Reflection\Document;
18
use Railt\Reflection\Type;
19
20
/**
21
 * Class FieldDefinition
22
 */
23
class FieldDefinition extends AbstractDependentTypeDefinition implements FieldDefinitionInterface
24
{
25
    use HasTypeIndication;
26
    use HasArguments;
27
28
    /**
29
     * FieldDefinition constructor.
30
     * @param TypeDefinition $parent
31
     * @param Document $document
32
     * @param string $name
33
     * @param string $type
34
     */
35
    public function __construct(TypeDefinition $parent, Document $document, string $name, string $type)
36
    {
37
        parent::__construct($parent, $document, $name);
38
39
        $this->setTypeDefinition($type);
40
    }
41
42
    /**
43
     * @return TypeInterface
44
     */
45
    public static function getType(): TypeInterface
46
    {
47
        return Type::of(Type::FIELD_DEFINITION);
48
    }
49
}
50