1
|
|
|
<?php |
2
|
|
|
namespace gossi\codegen\model\parts; |
3
|
|
|
|
4
|
|
|
trait ValueTrait { |
5
|
|
|
|
6
|
|
|
private $value; |
7
|
|
|
|
8
|
|
|
private $hasValue = false; |
9
|
|
|
|
10
|
|
|
private $expression; |
11
|
|
|
|
12
|
|
|
private $hasExpression = false; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @param string $value |
16
|
|
|
* @deprecated use `setValue()` instead |
17
|
|
|
* @return static |
18
|
|
|
*/ |
19
|
|
|
public function setDefaultValue($value) { |
20
|
|
|
return $this->setValue($value); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @deprecated use `unsetValue()` instead |
25
|
|
|
*/ |
26
|
|
|
public function unsetDefaultValue() { |
27
|
|
|
return $this->unsetValue(); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @deprecated use `getValue()` instead |
32
|
|
|
*/ |
33
|
|
|
public function getDefaultValue() { |
|
|
|
|
34
|
|
|
return $this->getValue(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @deprecated use `hasValue()` instead |
39
|
|
|
*/ |
40
|
|
|
public function hasDefaultValue() { |
41
|
|
|
return $this->hasValue(); |
42
|
|
|
} |
43
|
|
|
|
44
|
21 |
|
public function setValue($value) { |
45
|
21 |
|
$this->value = $value; |
46
|
21 |
|
$this->hasValue = true; |
47
|
|
|
|
48
|
21 |
|
return $this; |
49
|
|
|
} |
50
|
|
|
|
51
|
1 |
|
public function unsetValue() { |
52
|
1 |
|
$this->value = null; |
53
|
1 |
|
$this->hasValue = false; |
54
|
|
|
|
55
|
1 |
|
return $this; |
56
|
|
|
} |
57
|
|
|
|
58
|
12 |
|
public function getValue() { |
59
|
12 |
|
return $this->value; |
60
|
|
|
} |
61
|
|
|
|
62
|
20 |
|
public function hasValue() { |
63
|
20 |
|
return $this->hasValue || $this->hasExpression; |
64
|
|
|
} |
65
|
|
|
|
66
|
5 |
|
public function isExpression() { |
|
|
|
|
67
|
5 |
|
return $this->hasExpression; |
68
|
|
|
} |
69
|
|
|
|
70
|
3 |
|
public function setExpression($expr) { |
71
|
3 |
|
$this->expression = $expr; |
72
|
3 |
|
$this->hasExpression = true; |
73
|
|
|
|
74
|
3 |
|
return $this; |
75
|
|
|
} |
76
|
|
|
|
77
|
2 |
|
public function getExpression() { |
|
|
|
|
78
|
2 |
|
return $this->expression; |
79
|
|
|
} |
80
|
|
|
|
81
|
1 |
|
public function unsetExpression() { |
82
|
1 |
|
$this->expression = null; |
83
|
1 |
|
$this->hasExpression = false; |
84
|
|
|
|
85
|
1 |
|
return $this; |
86
|
|
|
} |
87
|
|
|
} |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.