Completed
Push — master ( 718f9d...90802e )
by Alexandr
02:52
created

Field::getAlias()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Date: 23.11.15
4
 *
5
 * @author Portey Vasil <[email protected]>
6
 */
7
8
namespace Youshido\GraphQL\Parser\Ast;
9
10
11
use Youshido\GraphQL\Parser\Ast\Interfaces\FieldInterface;
12
use Youshido\GraphQL\Parser\Location;
13
14
class Field extends AbstractAst implements FieldInterface
15
{
16
    use AstArgumentsTrait;
17
18
    /** @var string */
19
    private $name;
20
21
    /** @var null|string */
22
    private $alias = null;
23
24
    /**
25
     * @param string   $name
26
     * @param string   $alias
27
     * @param array    $arguments
28
     * @param Location $location
29
     */
30 58
    public function __construct($name, $alias, array $arguments, Location $location)
31
    {
32 58
        parent::__construct($location);
33
34 58
        $this->name      = $name;
35 58
        $this->alias     = $alias;
36 58
        $this->setArguments($arguments);
37 58
    }
38
39
    /**
40
     * @return string
41
     */
42 28
    public function getName()
43
    {
44 28
        return $this->name;
45
    }
46
47
    /**
48
     * @param string $name
49
     */
50 1
    public function setName($name)
51
    {
52 1
        $this->name = $name;
53 1
    }
54
55
    /**
56
     * @return null|string
57
     */
58 28
    public function getAlias()
59
    {
60 28
        return $this->alias;
61
    }
62
63
    /**
64
     * @param null|string $alias
65
     */
66 1
    public function setAlias($alias)
67
    {
68 1
        $this->alias = $alias;
69 1
    }
70
71
    public function hasFields()
72
    {
73
        return false;
74
    }
75
76
}