1
|
|
|
<?php namespace Anomaly\Streams\Platform\Addon; |
2
|
|
|
|
3
|
|
|
use Anomaly\Streams\Platform\Addon\FieldType\FieldType; |
4
|
|
|
use Anomaly\Streams\Platform\Addon\Module\Module; |
5
|
|
|
use Anomaly\Streams\Platform\Addon\Plugin\Plugin; |
6
|
|
|
use Anomaly\Streams\Platform\Addon\Theme\Theme; |
7
|
|
|
use Illuminate\Foundation\Application; |
8
|
|
|
use Illuminate\Foundation\Bus\DispatchesJobs; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class AddonServiceProvider |
12
|
|
|
* |
13
|
|
|
* @link http://pyrocms.com/ |
14
|
|
|
* @author PyroCMS, Inc. <[email protected]> |
15
|
|
|
* @author Ryan Thompson <[email protected]> |
16
|
|
|
*/ |
17
|
|
|
class AddonServiceProvider |
18
|
|
|
{ |
19
|
|
|
|
20
|
|
|
use DispatchesJobs; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Class aliases. |
24
|
|
|
* |
25
|
|
|
* @var array |
26
|
|
|
*/ |
27
|
|
|
protected $aliases = []; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class bindings. |
31
|
|
|
* |
32
|
|
|
* @var array |
33
|
|
|
*/ |
34
|
|
|
protected $bindings = []; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* The addon commands. |
38
|
|
|
* |
39
|
|
|
* @var array |
40
|
|
|
*/ |
41
|
|
|
protected $commands = []; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* The addon command schedules. |
45
|
|
|
* |
46
|
|
|
* @var array |
47
|
|
|
*/ |
48
|
|
|
protected $schedules = []; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* The addon view overrides. |
52
|
|
|
* |
53
|
|
|
* @var array |
54
|
|
|
*/ |
55
|
|
|
protected $overrides = []; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* The addon plugins. |
59
|
|
|
* |
60
|
|
|
* @var array |
61
|
|
|
*/ |
62
|
|
|
protected $plugins = []; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Addon routes. |
66
|
|
|
* |
67
|
|
|
* @var array |
68
|
|
|
*/ |
69
|
|
|
protected $routes = []; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Addon API routes. |
73
|
|
|
* |
74
|
|
|
* @var array |
75
|
|
|
*/ |
76
|
|
|
protected $api = []; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Addon middleware. |
80
|
|
|
* |
81
|
|
|
* @var array |
82
|
|
|
*/ |
83
|
|
|
protected $middleware = []; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Addon route middleware. |
87
|
|
|
* |
88
|
|
|
* @var array |
89
|
|
|
*/ |
90
|
|
|
protected $routeMiddleware = []; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Addon event listeners. |
94
|
|
|
* |
95
|
|
|
* @var array |
96
|
|
|
*/ |
97
|
|
|
protected $listeners = []; |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Addon providers. |
101
|
|
|
* |
102
|
|
|
* @var array |
103
|
|
|
*/ |
104
|
|
|
protected $providers = []; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Singleton bindings. |
108
|
|
|
* |
109
|
|
|
* @var array |
110
|
|
|
*/ |
111
|
|
|
protected $singletons = []; |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* The addon view overrides |
115
|
|
|
* for mobile agents only. |
116
|
|
|
* |
117
|
|
|
* @var array |
118
|
|
|
*/ |
119
|
|
|
protected $mobile = []; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* The application instance. |
123
|
|
|
* |
124
|
|
|
* @var Application |
125
|
|
|
*/ |
126
|
|
|
protected $app; |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* The addon instance. |
130
|
|
|
* |
131
|
|
|
* @var FieldType|Module|Plugin|Theme |
132
|
|
|
*/ |
133
|
|
|
protected $addon; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Create a new AddonServiceProvider instance. |
137
|
|
|
* |
138
|
|
|
* @param Application $app |
139
|
|
|
* @param Addon $addon |
140
|
|
|
*/ |
141
|
|
|
public function __construct(Application $app, Addon $addon) |
142
|
|
|
{ |
143
|
|
|
$this->app = $app; |
144
|
|
|
$this->addon = $addon; |
|
|
|
|
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* Get class aliases. |
149
|
|
|
* |
150
|
|
|
* @return array |
151
|
|
|
*/ |
152
|
|
|
public function getAliases() |
153
|
|
|
{ |
154
|
|
|
return $this->aliases; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Get class bindings. |
159
|
|
|
* |
160
|
|
|
* @return array |
161
|
|
|
*/ |
162
|
|
|
public function getBindings() |
163
|
|
|
{ |
164
|
|
|
return $this->bindings; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Get the singleton bindings. |
169
|
|
|
* |
170
|
|
|
* @return array |
171
|
|
|
*/ |
172
|
|
|
public function getSingletons() |
173
|
|
|
{ |
174
|
|
|
return $this->singletons; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* Get the providers. |
179
|
|
|
* |
180
|
|
|
* @return array |
181
|
|
|
*/ |
182
|
|
|
public function getProviders() |
183
|
|
|
{ |
184
|
|
|
return $this->providers; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Get the addon commands. |
189
|
|
|
* |
190
|
|
|
* @return array |
191
|
|
|
*/ |
192
|
|
|
public function getCommands() |
193
|
|
|
{ |
194
|
|
|
return $this->commands; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Get the addon command schedules. |
199
|
|
|
* |
200
|
|
|
* @return array |
201
|
|
|
*/ |
202
|
|
|
public function getSchedules() |
203
|
|
|
{ |
204
|
|
|
return $this->schedules; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* Get the addon view overrides. |
209
|
|
|
* |
210
|
|
|
* @return array |
211
|
|
|
*/ |
212
|
|
|
public function getOverrides() |
213
|
|
|
{ |
214
|
|
|
return $this->overrides; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* Get the mobile view overrides. |
219
|
|
|
* |
220
|
|
|
* @return array |
221
|
|
|
*/ |
222
|
|
|
public function getMobile() |
223
|
|
|
{ |
224
|
|
|
return $this->mobile; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* Ge the event listeners. |
229
|
|
|
* |
230
|
|
|
* @return array |
231
|
|
|
*/ |
232
|
|
|
public function getListeners() |
233
|
|
|
{ |
234
|
|
|
return $this->listeners; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* Get the addon routes. |
239
|
|
|
* |
240
|
|
|
* @return array |
241
|
|
|
*/ |
242
|
|
|
public function getRoutes() |
243
|
|
|
{ |
244
|
|
|
$routes = []; |
245
|
|
|
|
246
|
|
|
foreach (glob($this->addon->getPath('resources/routes/*')) as $include) { |
247
|
|
|
$include = require $include; |
248
|
|
|
|
249
|
|
|
if (!is_array($include)) { |
250
|
|
|
continue; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
$routes = array_merge($include, $routes); |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
return array_merge($this->routes, $routes); |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* Get the addon API routes. |
261
|
|
|
* |
262
|
|
|
* @return array |
263
|
|
|
*/ |
264
|
|
|
public function getApi() |
265
|
|
|
{ |
266
|
|
|
return $this->api; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* Get the middleware. |
271
|
|
|
* |
272
|
|
|
* @return array |
273
|
|
|
*/ |
274
|
|
|
public function getMiddleware() |
275
|
|
|
{ |
276
|
|
|
return $this->middleware; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* Get the route middleware. |
281
|
|
|
* |
282
|
|
|
* @return array |
283
|
|
|
*/ |
284
|
|
|
public function getRouteMiddleware() |
285
|
|
|
{ |
286
|
|
|
return $this->routeMiddleware; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* Get the addon plugins. |
291
|
|
|
* |
292
|
|
|
* @return array |
293
|
|
|
*/ |
294
|
|
|
public function getPlugins() |
295
|
|
|
{ |
296
|
|
|
return $this->plugins; |
297
|
|
|
} |
298
|
|
|
} |
299
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..