1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the puli/cli package. |
5
|
|
|
* |
6
|
|
|
* (c) Bernhard Schussek <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Puli\Cli\Proxy; |
13
|
|
|
|
14
|
|
|
use Puli\Manager\Api\Container; |
15
|
|
|
use Puli\Manager\Api\Discovery\BindingDescriptor; |
16
|
|
|
use Puli\Manager\Api\Discovery\BindingTypeDescriptor; |
17
|
|
|
use Puli\Manager\Api\Discovery\DiscoveryManager; |
18
|
|
|
use Rhumsaa\Uuid\Uuid; |
19
|
|
|
use Webmozart\Expression\Expression; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Proxies a lazily fetched discovery manager. |
23
|
|
|
* |
24
|
|
|
* @since 1.0 |
25
|
|
|
* |
26
|
|
|
* @author Bernhard Schussek <[email protected]> |
27
|
|
|
*/ |
28
|
|
|
class DiscoveryManagerProxy implements DiscoveryManager |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* @var Container |
32
|
|
|
*/ |
33
|
|
|
private $puli; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Creates the proxy. |
37
|
|
|
* |
38
|
|
|
* @param Container $puli The service locator to fetch the actual discovery |
39
|
|
|
* manager from |
40
|
|
|
*/ |
41
|
|
|
public function __construct(Container $puli) |
42
|
|
|
{ |
43
|
|
|
$this->puli = $puli; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* {@inheritdoc} |
48
|
|
|
*/ |
49
|
|
|
public function getContext() |
50
|
|
|
{ |
51
|
|
|
return $this->puli->getDiscoveryManager()->getContext(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* {@inheritdoc} |
56
|
|
|
*/ |
57
|
|
|
public function addRootTypeDescriptor(BindingTypeDescriptor $typeDescriptor, $flags = 0) |
58
|
|
|
{ |
59
|
|
|
$this->puli->getDiscoveryManager()->addRootTypeDescriptor($typeDescriptor, $flags); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* {@inheritdoc} |
64
|
|
|
*/ |
65
|
|
|
public function removeRootTypeDescriptor($typeName) |
66
|
|
|
{ |
67
|
|
|
$this->puli->getDiscoveryManager()->removeRootTypeDescriptor($typeName); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* {@inheritdoc} |
72
|
|
|
*/ |
73
|
|
|
public function removeRootTypeDescriptors(Expression $expr) |
74
|
|
|
{ |
75
|
|
|
$this->puli->getDiscoveryManager()->removeRootTypeDescriptors($expr); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* {@inheritdoc} |
80
|
|
|
*/ |
81
|
|
|
public function clearRootTypeDescriptors() |
82
|
|
|
{ |
83
|
|
|
$this->puli->getDiscoveryManager()->clearRootTypeDescriptors(); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* {@inheritdoc} |
88
|
|
|
*/ |
89
|
|
|
public function getRootTypeDescriptor($typeName) |
90
|
|
|
{ |
91
|
|
|
return $this->puli->getDiscoveryManager()->getRootTypeDescriptor($typeName); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* {@inheritdoc} |
96
|
|
|
*/ |
97
|
|
|
public function getRootTypeDescriptors() |
98
|
|
|
{ |
99
|
|
|
return $this->puli->getDiscoveryManager()->getRootTypeDescriptors(); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* {@inheritdoc} |
104
|
|
|
*/ |
105
|
|
|
public function findRootTypeDescriptors(Expression $expr) |
106
|
|
|
{ |
107
|
|
|
return $this->puli->getDiscoveryManager()->findRootTypeDescriptors($expr); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* {@inheritdoc} |
112
|
|
|
*/ |
113
|
|
|
public function hasRootTypeDescriptor($typeName) |
114
|
|
|
{ |
115
|
|
|
return $this->puli->getDiscoveryManager()->hasRootTypeDescriptor($typeName); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* {@inheritdoc} |
120
|
|
|
*/ |
121
|
|
|
public function hasRootTypeDescriptors(Expression $expr = null) |
122
|
|
|
{ |
123
|
|
|
return $this->puli->getDiscoveryManager()->hasRootTypeDescriptors($expr); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* {@inheritdoc} |
128
|
|
|
*/ |
129
|
|
|
public function getTypeDescriptor($typeName, $moduleName) |
130
|
|
|
{ |
131
|
|
|
return $this->puli->getDiscoveryManager()->getTypeDescriptor($typeName, $moduleName); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* {@inheritdoc} |
136
|
|
|
*/ |
137
|
|
|
public function getTypeDescriptors() |
138
|
|
|
{ |
139
|
|
|
return $this->puli->getDiscoveryManager()->getTypeDescriptors(); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* {@inheritdoc} |
144
|
|
|
*/ |
145
|
|
|
public function findTypeDescriptors(Expression $expr) |
146
|
|
|
{ |
147
|
|
|
return $this->puli->getDiscoveryManager()->findTypeDescriptors($expr); |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* {@inheritdoc} |
152
|
|
|
*/ |
153
|
|
|
public function hasTypeDescriptor($typeName, $moduleName = null) |
154
|
|
|
{ |
155
|
|
|
return $this->puli->getDiscoveryManager()->hasTypeDescriptor($typeName, $moduleName); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* {@inheritdoc} |
160
|
|
|
*/ |
161
|
|
|
public function hasTypeDescriptors(Expression $expr = null) |
162
|
|
|
{ |
163
|
|
|
return $this->puli->getDiscoveryManager()->hasTypeDescriptors($expr); |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* {@inheritdoc} |
168
|
|
|
*/ |
169
|
|
|
public function addRootBindingDescriptor(BindingDescriptor $bindingDescriptor, $flags = 0) |
170
|
|
|
{ |
171
|
|
|
$this->puli->getDiscoveryManager()->addRootBindingDescriptor($bindingDescriptor, $flags); |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* {@inheritdoc} |
176
|
|
|
*/ |
177
|
|
|
public function removeRootBindingDescriptor(Uuid $uuid) |
178
|
|
|
{ |
179
|
|
|
$this->puli->getDiscoveryManager()->removeRootBindingDescriptor($uuid); |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* {@inheritdoc} |
184
|
|
|
*/ |
185
|
|
|
public function removeRootBindingDescriptors(Expression $expr) |
186
|
|
|
{ |
187
|
|
|
$this->puli->getDiscoveryManager()->removeRootBindingDescriptors($expr); |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* {@inheritdoc} |
192
|
|
|
*/ |
193
|
|
|
public function clearRootBindingDescriptors() |
194
|
|
|
{ |
195
|
|
|
$this->puli->getDiscoveryManager()->clearRootBindingDescriptors(); |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* {@inheritdoc} |
200
|
|
|
*/ |
201
|
|
|
public function getRootBindingDescriptor(Uuid $uuid) |
202
|
|
|
{ |
203
|
|
|
return $this->puli->getDiscoveryManager()->getRootBindingDescriptor($uuid); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* {@inheritdoc} |
208
|
|
|
*/ |
209
|
|
|
public function getRootBindingDescriptors() |
210
|
|
|
{ |
211
|
|
|
return $this->puli->getDiscoveryManager()->getRootBindingDescriptors(); |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* {@inheritdoc} |
216
|
|
|
*/ |
217
|
|
|
public function findRootBindingDescriptors(Expression $expr) |
218
|
|
|
{ |
219
|
|
|
return $this->puli->getDiscoveryManager()->findRootBindingDescriptors($expr); |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* {@inheritdoc} |
224
|
|
|
*/ |
225
|
|
|
public function hasRootBindingDescriptor(Uuid $uuid) |
226
|
|
|
{ |
227
|
|
|
return $this->puli->getDiscoveryManager()->hasRootBindingDescriptor($uuid); |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* {@inheritdoc} |
232
|
|
|
*/ |
233
|
|
|
public function hasRootBindingDescriptors(Expression $expr = null) |
234
|
|
|
{ |
235
|
|
|
return $this->puli->getDiscoveryManager()->hasRootBindingDescriptors($expr); |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* {@inheritdoc} |
240
|
|
|
*/ |
241
|
|
|
public function enableBindingDescriptor(Uuid $uuid) |
242
|
|
|
{ |
243
|
|
|
$this->puli->getDiscoveryManager()->enableBindingDescriptor($uuid); |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* {@inheritdoc} |
248
|
|
|
*/ |
249
|
|
|
public function disableBindingDescriptor(Uuid $uuid) |
250
|
|
|
{ |
251
|
|
|
$this->puli->getDiscoveryManager()->disableBindingDescriptor($uuid); |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* {@inheritdoc} |
256
|
|
|
*/ |
257
|
|
|
public function removeObsoleteDisabledBindingDescriptors() |
258
|
|
|
{ |
259
|
|
|
$this->puli->getDiscoveryManager()->removeObsoleteDisabledBindingDescriptors(); |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* {@inheritdoc} |
264
|
|
|
*/ |
265
|
|
|
public function getBindingDescriptor(Uuid $uuid) |
266
|
|
|
{ |
267
|
|
|
return $this->puli->getDiscoveryManager()->getBindingDescriptor($uuid); |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* {@inheritdoc} |
272
|
|
|
*/ |
273
|
|
|
public function getBindingDescriptors() |
274
|
|
|
{ |
275
|
|
|
return $this->puli->getDiscoveryManager()->getBindingDescriptors(); |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* {@inheritdoc} |
280
|
|
|
*/ |
281
|
|
|
public function findBindingDescriptors(Expression $expr) |
282
|
|
|
{ |
283
|
|
|
return $this->puli->getDiscoveryManager()->findBindingDescriptors($expr); |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* {@inheritdoc} |
288
|
|
|
*/ |
289
|
|
|
public function hasBindingDescriptor(Uuid $uuid) |
290
|
|
|
{ |
291
|
|
|
return $this->puli->getDiscoveryManager()->hasBindingDescriptor($uuid); |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
/** |
295
|
|
|
* {@inheritdoc} |
296
|
|
|
*/ |
297
|
|
|
public function hasBindingDescriptors(Expression $expr = null) |
298
|
|
|
{ |
299
|
|
|
return $this->puli->getDiscoveryManager()->hasBindingDescriptors($expr); |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
/** |
303
|
|
|
* {@inheritdoc} |
304
|
|
|
*/ |
305
|
|
|
public function buildDiscovery() |
306
|
|
|
{ |
307
|
|
|
$this->puli->getDiscoveryManager()->buildDiscovery(); |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* {@inheritdoc} |
312
|
|
|
*/ |
313
|
|
|
public function clearDiscovery() |
314
|
|
|
{ |
315
|
|
|
$this->puli->getDiscoveryManager()->clearDiscovery(); |
316
|
|
|
} |
317
|
|
|
} |
318
|
|
|
|