1
|
|
|
<?php declare(strict_types = 1); |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: root |
5
|
|
|
* Date: 02.08.16 |
6
|
|
|
* Time: 0:46. |
7
|
|
|
*/ |
8
|
|
|
namespace samsonframework\container\definition; |
9
|
|
|
|
10
|
|
|
use samsonframework\container\definition\reference\ReferenceInterface; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class AbstractPropertyDefinition |
14
|
|
|
* |
15
|
|
|
* @author Ruslan Molodyko <[email protected]> |
16
|
|
|
*/ |
17
|
|
|
abstract class AbstractPropertyDefinition extends AbstractDefinition |
18
|
|
|
{ |
19
|
|
|
/** @var ReferenceInterface */ |
20
|
|
|
protected $dependency; |
21
|
|
|
/** @var int Property modifiers */ |
22
|
|
|
public $modifiers = 0; |
23
|
|
|
/** @var bool Flag that property is public */ |
24
|
|
|
public $isPublic = false; |
25
|
|
|
/** @var string Property typeHint from typeHint hint */ |
26
|
|
|
public $typeHint = ''; |
27
|
|
|
/** @var mixed Property value */ |
28
|
|
|
public $value; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @return int |
32
|
|
|
*/ |
33
|
|
|
public function getModifiers(): int |
34
|
|
|
{ |
35
|
|
|
return $this->modifiers; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param int $modifiers |
40
|
|
|
* @return AbstractPropertyDefinition |
41
|
|
|
*/ |
42
|
|
|
public function setModifiers(int $modifiers): AbstractPropertyDefinition |
43
|
|
|
{ |
44
|
|
|
$this->modifiers = $modifiers; |
45
|
|
|
|
46
|
|
|
return $this; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return boolean |
51
|
|
|
*/ |
52
|
|
|
public function getIsPublic(): bool |
53
|
|
|
{ |
54
|
|
|
return $this->isPublic; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param boolean $isPublic |
59
|
|
|
* @return AbstractPropertyDefinition |
60
|
|
|
*/ |
61
|
|
|
public function setIsPublic(bool $isPublic): AbstractPropertyDefinition |
62
|
|
|
{ |
63
|
|
|
$this->isPublic = $isPublic; |
64
|
|
|
|
65
|
|
|
return $this; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return string |
70
|
|
|
*/ |
71
|
|
|
public function getTypeHint(): string |
72
|
|
|
{ |
73
|
|
|
return $this->typeHint; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param string $typeHint |
78
|
|
|
* @return AbstractPropertyDefinition |
79
|
|
|
*/ |
80
|
|
|
public function setTypeHint(string $typeHint): AbstractPropertyDefinition |
81
|
|
|
{ |
82
|
|
|
$this->typeHint = $typeHint; |
83
|
|
|
|
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return mixed |
89
|
|
|
*/ |
90
|
|
|
public function getValue() |
91
|
|
|
{ |
92
|
|
|
return $this->value; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param mixed $value |
97
|
|
|
* @return AbstractPropertyDefinition |
98
|
|
|
*/ |
99
|
|
|
public function setValue($value): AbstractPropertyDefinition |
100
|
|
|
{ |
101
|
|
|
$this->value = $value; |
102
|
|
|
|
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @param ReferenceInterface $dependency |
108
|
|
|
* @return AbstractPropertyDefinition |
109
|
|
|
*/ |
110
|
|
|
public function setDependency(ReferenceInterface $dependency): AbstractPropertyDefinition |
111
|
|
|
{ |
112
|
|
|
$this->dependency = $dependency; |
113
|
|
|
|
114
|
|
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return ReferenceInterface |
119
|
|
|
*/ |
120
|
3 |
|
public function getDependency(): ReferenceInterface |
121
|
|
|
{ |
122
|
3 |
|
return $this->dependency; |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|