1 | <?php |
||
10 | class Variable implements ValueInterface |
||
11 | { |
||
12 | |||
13 | /** @var string */ |
||
14 | private $name; |
||
15 | |||
16 | private $value; |
||
17 | |||
18 | 3 | public function __construct($name) |
|
22 | |||
23 | /** |
||
24 | * @return mixed |
||
25 | * |
||
26 | * @throws \Exception |
||
27 | */ |
||
28 | 1 | public function getValue() |
|
29 | { |
||
30 | 1 | if (!$this->value) { |
|
31 | throw new \Exception('Value not setted to variable'); |
||
32 | } |
||
33 | |||
34 | 1 | return $this->value; |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * @param mixed $value |
||
39 | */ |
||
40 | 1 | public function setValue($value) |
|
41 | { |
||
42 | 1 | $this->value = $value; |
|
43 | 1 | } |
|
44 | |||
45 | /** |
||
46 | * @return string |
||
47 | */ |
||
48 | 1 | public function getName() |
|
49 | { |
||
50 | 1 | return $this->name; |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param string $name |
||
55 | */ |
||
56 | public function setName($name) |
||
60 | } |