1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Saxulum\Accessor; |
4
|
|
|
|
5
|
|
|
class CallbackBag |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* @var Prop |
9
|
|
|
*/ |
10
|
|
|
protected $prop; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @var object |
14
|
|
|
*/ |
15
|
|
|
protected $object; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var mixed |
19
|
|
|
*/ |
20
|
|
|
protected $property; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var array |
24
|
|
|
*/ |
25
|
|
|
protected $arguments; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param Prop $prop |
29
|
|
|
* @param $object |
30
|
|
|
* @param $property |
31
|
|
|
* @param array $arguments |
32
|
|
|
*/ |
33
|
|
|
public function __construct(Prop $prop, &$object, &$property, array $arguments) |
34
|
|
|
{ |
35
|
|
|
$this->prop = $prop; |
36
|
|
|
$this->object = &$object; |
37
|
|
|
$this->property = &$property; |
38
|
|
|
$this->arguments = $arguments; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @return Prop |
43
|
|
|
*/ |
44
|
|
|
public function getProp() |
45
|
|
|
{ |
46
|
|
|
return $this->prop; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return object |
51
|
|
|
*/ |
52
|
|
|
public function &getObject() |
53
|
|
|
{ |
54
|
|
|
return $this->object; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param mixed $property |
59
|
|
|
*/ |
60
|
|
|
public function setProperty($property) |
61
|
|
|
{ |
62
|
|
|
$this->property = $property; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return mixed |
67
|
|
|
*/ |
68
|
|
|
public function &getProperty() |
69
|
|
|
{ |
70
|
|
|
return $this->property; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return array |
75
|
|
|
*/ |
76
|
|
|
public function getArguments() |
77
|
|
|
{ |
78
|
|
|
return $this->arguments; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param int $index |
83
|
|
|
* @return bool |
84
|
|
|
*/ |
85
|
|
|
public function argumentExists($index) |
86
|
|
|
{ |
87
|
|
|
return array_key_exists($index, $this->arguments); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param int $index |
92
|
|
|
* @param mixed $default |
93
|
|
|
* @return mixed |
94
|
|
|
*/ |
95
|
|
|
public function getArgument($index, $default = null) |
96
|
|
|
{ |
97
|
|
|
return array_key_exists($index, $this->arguments) ? $this->arguments[$index] : $default; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
|
|
public function getName() |
104
|
|
|
{ |
105
|
|
|
return $this->prop->getName(); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @return null|string |
110
|
|
|
*/ |
111
|
|
|
public function getHint() |
112
|
|
|
{ |
113
|
|
|
return $this->prop->getHint(); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @return null|string |
118
|
|
|
*/ |
119
|
|
|
public function getMappedBy() |
120
|
|
|
{ |
121
|
|
|
return $this->prop->getMappedBy(); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return null|string |
126
|
|
|
*/ |
127
|
|
|
public function getMappedType() |
128
|
|
|
{ |
129
|
|
|
return $this->prop->getMappedType(); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @return bool|null |
134
|
|
|
*/ |
135
|
|
|
public function getNullable() |
136
|
|
|
{ |
137
|
|
|
return $this->prop->getNullable(); |
138
|
|
|
} |
139
|
|
|
} |
140
|
|
|
|