Completed
Push — master ( 5bf303...8cd23b )
by Portey
03:14
created

Variable::getType()   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 1
Bugs 0 Features 0
Metric Value
c 1
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\Value;
9
10
class Variable implements ValueInterface
11
{
12
13
    /** @var  string */
14
    private $name;
15
16
    /** @var  mixed */
17
    private $value;
18
19
    /** @var string */
20
    private $type;
21
22 3
    public function __construct($name, $type)
23
    {
24 3
        $this->name = $name;
25 3
        $this->type = $type;
26 3
    }
27
28
    /**
29
     * @return mixed
30
     *
31
     * @throws \Exception
32
     */
33 1
    public function getValue()
34
    {
35 1
        if (!$this->value) {
36
            throw new \Exception('Value not setted to variable');
37
        }
38
39 1
        return $this->value;
40
    }
41
42
    /**
43
     * @param mixed $value
44
     */
45 1
    public function setValue($value)
46
    {
47 1
        $this->value = $value;
48 1
    }
49
50
    /**
51
     * @return string
52
     */
53 2
    public function getName()
54
    {
55 2
        return $this->name;
56
    }
57
58
    /**
59
     * @param string $name
60
     */
61
    public function setName($name)
62
    {
63
        $this->name = $name;
64
    }
65
66
    /**
67
     * @return string
68
     */
69 2
    public function getType()
70
    {
71 2
        return $this->type;
72
    }
73
74
    /**
75
     * @param string $type
76
     */
77
    public function setType($type)
78
    {
79
        $this->type = $type;
80
    }
81
82
}