1 | <?php |
||
8 | class ClassDefinition |
||
9 | { |
||
10 | /** |
||
11 | * Class |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $class; |
||
15 | |||
16 | /** |
||
17 | * Array of arguments |
||
18 | * @var array |
||
19 | */ |
||
20 | protected $arguments = []; |
||
21 | |||
22 | /** |
||
23 | * Array of setters |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $calls = []; |
||
27 | |||
28 | /** |
||
29 | * Array of properties |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $properties = []; |
||
33 | |||
34 | public function __construct($class, array $arguments = [], array $calls = [], array $properties = []) |
||
41 | |||
42 | /** |
||
43 | * Sets a argument |
||
44 | * @param int|string $indexOrName |
||
45 | * @param mixed $value |
||
46 | * @return $this |
||
47 | */ |
||
48 | public function setArgument($indexOrName, $value) |
||
53 | |||
54 | |||
55 | /** |
||
56 | * Sets array of arguments |
||
57 | * @param array $arguments |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function setArguments(array $arguments) |
||
65 | |||
66 | /** |
||
67 | * Gets all arguments of constructor |
||
68 | * @return array |
||
69 | */ |
||
70 | public function getArguments() |
||
74 | |||
75 | /** |
||
76 | * Gets the argument at the specified position of constructor |
||
77 | * @param int|string $indexOrName |
||
78 | * @return mixed |
||
79 | */ |
||
80 | public function getArgument($indexOrName) |
||
84 | |||
85 | /** |
||
86 | * Adds a setter |
||
87 | * @param string $method |
||
88 | * @param string|array $arguments |
||
89 | * @return $this |
||
90 | */ |
||
91 | public function setMethodCall($method, $arguments) |
||
96 | |||
97 | /** |
||
98 | * Sets array of setter |
||
99 | * @param array $calls |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function setMethodCalls(array $calls) |
||
107 | |||
108 | /** |
||
109 | * Gets all setter |
||
110 | * @return array |
||
111 | */ |
||
112 | public function getMethodCalls() |
||
116 | |||
117 | /** |
||
118 | * Gets the parameters of one setter |
||
119 | * @param string $method |
||
120 | * @return array|null |
||
121 | */ |
||
122 | public function getMethodCall($method) |
||
126 | |||
127 | /** |
||
128 | * @param array $properties |
||
129 | */ |
||
130 | public function setProperties($properties) |
||
134 | |||
135 | /** |
||
136 | * Gets all properties |
||
137 | * @return array |
||
138 | */ |
||
139 | public function getProperties() |
||
143 | |||
144 | /** |
||
145 | * Adds a property |
||
146 | * @param int|string $name |
||
147 | * @param mixed $value |
||
148 | * @return $this |
||
149 | */ |
||
150 | public function setProperty($name, $value) |
||
155 | |||
156 | /** |
||
157 | * Gets the property by given name |
||
158 | * @param string $name |
||
159 | * @return mixed |
||
160 | */ |
||
161 | public function getProperty($name) |
||
165 | |||
166 | |||
167 | /** |
||
168 | * Gets the class |
||
169 | * @return string |
||
170 | */ |
||
171 | public function getClass() |
||
175 | } |
||
176 |