1 | <?php |
||
30 | class Object extends AbstractDefinition implements ObjectDefinitionInterface |
||
31 | { |
||
32 | /** |
||
33 | * @readwrite |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $className; |
||
37 | |||
38 | /** |
||
39 | * @readwrite |
||
40 | * @var object |
||
41 | */ |
||
42 | protected $instance; |
||
43 | |||
44 | /** |
||
45 | * @readwrite |
||
46 | * @var array |
||
47 | */ |
||
48 | protected $constructArgs = []; |
||
49 | |||
50 | /** |
||
51 | * @readwrite |
||
52 | * @var array |
||
53 | */ |
||
54 | protected $properties = []; |
||
55 | |||
56 | /** |
||
57 | * @readwrite |
||
58 | * @var array |
||
59 | */ |
||
60 | protected $methods = []; |
||
61 | |||
62 | /** |
||
63 | * @var Inspector |
||
64 | */ |
||
65 | protected $classMetaData; |
||
66 | |||
67 | /** |
||
68 | * @readwrite |
||
69 | * @var ObjectResolver |
||
70 | */ |
||
71 | protected $resolver; |
||
72 | |||
73 | /** |
||
74 | * Gets class meta data (Inspector) |
||
75 | * |
||
76 | * @return Inspector |
||
77 | */ |
||
78 | 56 | protected function getClassMetaData() |
|
85 | |||
86 | /** |
||
87 | * Gets definition class name |
||
88 | * |
||
89 | * If class name is not set and there is an instance set the class name |
||
90 | * will be retrieved from instance object. |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | 72 | public function getClassName() |
|
101 | |||
102 | /** |
||
103 | * Gets the instance object for current definition |
||
104 | * |
||
105 | * If instance is not defined yet and the class name is set and |
||
106 | * is an existing class, a new instance will be created and the |
||
107 | * constructor arguments will be used. |
||
108 | * |
||
109 | * @return object |
||
110 | */ |
||
111 | 58 | public function getInstance() |
|
123 | |||
124 | /** |
||
125 | * Sets constructor arguments used on instance instantiation |
||
126 | * |
||
127 | * @param array $arguments |
||
128 | * @return $this|self |
||
129 | */ |
||
130 | 26 | public function setConstructArgs(array $arguments) |
|
135 | |||
136 | /** |
||
137 | * Set a method to be called when resolving this definition |
||
138 | * |
||
139 | * @param string $name Method name |
||
140 | * @param array $arguments Method parameters |
||
141 | * |
||
142 | * @return $this|self |
||
143 | */ |
||
144 | 34 | public function setMethod($name, array $arguments = []) |
|
156 | |||
157 | /** |
||
158 | * Sets property value when resolving this definition |
||
159 | * |
||
160 | * @param string $name The property name |
||
161 | * @param mixed $value The property value |
||
162 | * |
||
163 | * @return $this|self |
||
164 | */ |
||
165 | 30 | public function setProperty($name, $value) |
|
177 | |||
178 | /** |
||
179 | * Resolves current definition and returns its value |
||
180 | * |
||
181 | * @return mixed |
||
182 | */ |
||
183 | 58 | public function resolve() |
|
187 | |||
188 | /** |
||
189 | * Gets property values |
||
190 | * |
||
191 | * @return array |
||
192 | */ |
||
193 | 58 | public function getProperties() |
|
197 | |||
198 | /** |
||
199 | * Returns the list of methods to call |
||
200 | * |
||
201 | * @return mixed |
||
202 | */ |
||
203 | 58 | public function getMethods() |
|
207 | |||
208 | /** |
||
209 | * Returns resolver for this definition |
||
210 | * |
||
211 | * @return Resolver|ObjectResolver |
||
212 | */ |
||
213 | 58 | protected function getResolver() |
|
224 | } |