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

FieldDefinition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 27
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getType() 0 4 1
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