1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Stats\Providers; |
4
|
|
|
|
5
|
|
|
use Joomla\Application as JoomlaApplication; |
6
|
|
|
use Joomla\Database\DatabaseDriver; |
7
|
|
|
use Joomla\DI\Container; |
8
|
|
|
use Joomla\DI\ServiceProviderInterface; |
9
|
|
|
use Joomla\Input\Cli; |
10
|
|
|
use Joomla\Input\Input; |
11
|
|
|
use Psr\Cache\CacheItemPoolInterface; |
12
|
|
|
use Psr\Log\LoggerInterface; |
13
|
|
|
use Stats\CliApplication; |
14
|
|
|
use Stats\Commands as AppCommands; |
15
|
|
|
use Stats\Console; |
16
|
|
|
use Stats\Controllers\DisplayControllerGet; |
17
|
|
|
use Stats\Controllers\SubmitControllerCreate; |
18
|
|
|
use Stats\Controllers\SubmitControllerGet; |
19
|
|
|
use Stats\Database\Migrations; |
20
|
|
|
use Stats\GitHub\GitHub; |
21
|
|
|
use Stats\Models\StatsModel; |
22
|
|
|
use Stats\Router; |
23
|
|
|
use Stats\Views\Stats\StatsJsonView; |
24
|
|
|
use Stats\WebApplication; |
25
|
|
|
use TheIconic\Tracking\GoogleAnalytics\Analytics; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Application service provider |
29
|
|
|
* |
30
|
|
|
* @since 1.0 |
31
|
|
|
*/ |
32
|
|
|
class ApplicationServiceProvider implements ServiceProviderInterface |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* Registers the service provider with a DI container. |
36
|
|
|
* |
37
|
|
|
* @param Container $container The DI container. |
38
|
|
|
* |
39
|
|
|
* @return void |
40
|
|
|
* |
41
|
|
|
* @since 1.0 |
42
|
|
|
*/ |
43
|
1 |
|
public function register(Container $container) |
44
|
|
|
{ |
45
|
|
|
/* |
46
|
|
|
* Application Classes |
47
|
|
|
*/ |
48
|
|
|
|
49
|
1 |
|
$container->alias(CliApplication::class, JoomlaApplication\AbstractCliApplication::class) |
50
|
1 |
|
->share(JoomlaApplication\AbstractCliApplication::class, [$this, 'getCliApplicationService'], true); |
51
|
|
|
|
52
|
1 |
|
$container->alias(WebApplication::class, JoomlaApplication\AbstractWebApplication::class) |
53
|
1 |
|
->share(JoomlaApplication\AbstractWebApplication::class, [$this, 'getWebApplicationService'], true); |
54
|
|
|
|
55
|
|
|
/* |
56
|
|
|
* Application Class Dependencies |
57
|
|
|
*/ |
58
|
|
|
|
59
|
1 |
|
$container->share(Analytics::class, [$this, 'getAnalyticsService'], true); |
60
|
1 |
|
$container->share(Cli::class, [$this, 'getInputCliService'], true); |
61
|
1 |
|
$container->share(Console::class, [$this, 'getConsoleService'], true); |
62
|
1 |
|
$container->share(Input::class, [$this, 'getInputService'], true); |
63
|
1 |
|
$container->share(JoomlaApplication\Cli\Output\Processor\ColorProcessor::class, [$this, 'getColorProcessorService'], true); |
64
|
1 |
|
$container->share(JoomlaApplication\Cli\CliInput::class, [$this, 'getCliInputService'], true); |
65
|
1 |
|
$container->share(Router::class, [$this, 'getRouterService'], true); |
66
|
|
|
|
67
|
1 |
|
$container->alias(JoomlaApplication\Cli\CliOutput::class, JoomlaApplication\Cli\Output\Stdout::class) |
68
|
1 |
|
->share(JoomlaApplication\Cli\Output\Stdout::class, [$this, 'getCliOutputService'], true); |
69
|
|
|
|
70
|
|
|
/* |
71
|
|
|
* Console Commands |
72
|
|
|
*/ |
73
|
|
|
|
74
|
1 |
|
$container->share(AppCommands\Cache\ClearCommand::class, [$this, 'getCacheClearCommandService'], true); |
75
|
1 |
|
$container->share(AppCommands\HelpCommand::class, [$this, 'getHelpCommandService'], true); |
76
|
1 |
|
$container->share(AppCommands\InstallCommand::class, [$this, 'getInstallCommandService'], true); |
77
|
1 |
|
$container->share(AppCommands\Database\MigrateCommand::class, [$this, 'getDatabaseMigrateCommandService'], true); |
78
|
1 |
|
$container->share(AppCommands\Database\StatusCommand::class, [$this, 'getDatabaseStatusCommandService'], true); |
79
|
1 |
|
$container->share(AppCommands\SnapshotCommand::class, [$this, 'getSnapshotCommandService'], true); |
80
|
1 |
|
$container->share(AppCommands\Tags\JoomlaCommand::class, [$this, 'getTagsJoomlaCommandService'], true); |
81
|
1 |
|
$container->share(AppCommands\Tags\PhpCommand::class, [$this, 'getTagsPhpCommandService'], true); |
82
|
1 |
|
$container->share(AppCommands\UpdateCommand::class, [$this, 'getUpdateCommandService'], true); |
83
|
|
|
|
84
|
|
|
/* |
85
|
|
|
* MVC Layer |
86
|
|
|
*/ |
87
|
|
|
|
88
|
|
|
// Controllers |
89
|
1 |
|
$container->share(DisplayControllerGet::class, [$this, 'getDisplayControllerGetService'], true); |
90
|
1 |
|
$container->share(SubmitControllerCreate::class, [$this, 'getSubmitControllerCreateService'], true); |
91
|
1 |
|
$container->share(SubmitControllerGet::class, [$this, 'getSubmitControllerGetService'], true); |
92
|
|
|
|
93
|
|
|
// Models |
94
|
1 |
|
$container->share(StatsModel::class, [$this, 'getStatsModelService'], true); |
95
|
|
|
|
96
|
|
|
// Views |
97
|
1 |
|
$container->share(StatsJsonView::class, [$this, 'getStatsJsonViewService'], true); |
98
|
1 |
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Get the Analytics class service |
102
|
|
|
* |
103
|
|
|
* @param Container $container The DI container. |
104
|
|
|
* |
105
|
|
|
* @return Analytics |
106
|
|
|
* |
107
|
|
|
* @since 1.0 |
108
|
|
|
*/ |
109
|
1 |
|
public function getAnalyticsService(Container $container) |
|
|
|
|
110
|
|
|
{ |
111
|
1 |
|
return new Analytics(true); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Get the Cache\ClearCommand class service |
116
|
|
|
* |
117
|
|
|
* @param Container $container The DI container. |
118
|
|
|
* |
119
|
|
|
* @return AppCommands\Cache\ClearCommand |
120
|
|
|
* |
121
|
|
|
* @since 1.0 |
122
|
|
|
*/ |
123
|
1 |
View Code Duplication |
public function getCacheClearCommandService(Container $container) |
|
|
|
|
124
|
|
|
{ |
125
|
1 |
|
$command = new AppCommands\Cache\ClearCommand($container->get(CacheItemPoolInterface::class)); |
126
|
|
|
|
127
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
128
|
1 |
|
$command->setInput($container->get(Input::class)); |
129
|
|
|
|
130
|
1 |
|
return $command; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Get the CLI application service |
135
|
|
|
* |
136
|
|
|
* @param Container $container The DI container. |
137
|
|
|
* |
138
|
|
|
* @return CliApplication |
139
|
|
|
* |
140
|
|
|
* @since 1.0 |
141
|
|
|
*/ |
142
|
1 |
|
public function getCliApplicationService(Container $container) |
143
|
|
|
{ |
144
|
1 |
|
$application = new CliApplication( |
145
|
1 |
|
$container->get(Cli::class), |
146
|
1 |
|
$container->get('config'), |
147
|
1 |
|
$container->get(JoomlaApplication\Cli\CliOutput::class), |
148
|
1 |
|
$container->get(JoomlaApplication\Cli\CliInput::class), |
149
|
1 |
|
$container->get(Console::class) |
150
|
1 |
|
); |
151
|
|
|
|
152
|
|
|
// Inject extra services |
153
|
1 |
|
$application->setContainer($container); |
154
|
1 |
|
$application->setLogger($container->get('monolog.logger.cli')); |
155
|
|
|
|
156
|
1 |
|
return $application; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Get the CliInput class service |
161
|
|
|
* |
162
|
|
|
* @param Container $container The DI container. |
163
|
|
|
* |
164
|
|
|
* @return JoomlaApplication\Cli\CliInput |
165
|
|
|
* |
166
|
|
|
* @since 1.0 |
167
|
|
|
*/ |
168
|
1 |
|
public function getCliInputService(Container $container) |
|
|
|
|
169
|
|
|
{ |
170
|
1 |
|
return new JoomlaApplication\Cli\CliInput; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Get the CliOutput class service |
175
|
|
|
* |
176
|
|
|
* @param Container $container The DI container. |
177
|
|
|
* |
178
|
|
|
* @return JoomlaApplication\Cli\CliOutput |
179
|
|
|
* |
180
|
|
|
* @since 1.0 |
181
|
|
|
*/ |
182
|
1 |
|
public function getCliOutputService(Container $container) |
183
|
|
|
{ |
184
|
1 |
|
return new JoomlaApplication\Cli\Output\Stdout($container->get(JoomlaApplication\Cli\Output\Processor\ColorProcessor::class)); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Get the ColorProcessor class service |
189
|
|
|
* |
190
|
|
|
* @param Container $container The DI container. |
191
|
|
|
* |
192
|
|
|
* @return JoomlaApplication\Cli\Output\Processor\ColorProcessor |
193
|
|
|
* |
194
|
|
|
* @since 1.0 |
195
|
|
|
*/ |
196
|
1 |
|
public function getColorProcessorService(Container $container) |
197
|
|
|
{ |
198
|
1 |
|
$processor = new JoomlaApplication\Cli\Output\Processor\ColorProcessor; |
199
|
|
|
|
200
|
|
|
/** @var Input $input */ |
201
|
1 |
|
$input = $container->get(Cli::class); |
202
|
|
|
|
203
|
1 |
|
if ($input->getBool('nocolors', false)) |
204
|
1 |
|
{ |
205
|
|
|
$processor->noColors = true; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
// Setup app colors (also required in "nocolors" mode - to strip them). |
209
|
1 |
|
$processor->addStyle('title', new JoomlaApplication\Cli\ColorStyle('yellow', '', ['bold'])); |
210
|
|
|
|
211
|
1 |
|
return $processor; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Get the console service |
216
|
|
|
* |
217
|
|
|
* @param Container $container The DI container. |
218
|
|
|
* |
219
|
|
|
* @return Console |
220
|
|
|
* |
221
|
|
|
* @since 1.0 |
222
|
|
|
*/ |
223
|
1 |
|
public function getConsoleService(Container $container) |
224
|
|
|
{ |
225
|
1 |
|
$console = new Console; |
226
|
1 |
|
$console->setContainer($container); |
227
|
|
|
|
228
|
1 |
|
return $console; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* Get the Database\MigrateCommand class service |
233
|
|
|
* |
234
|
|
|
* @param Container $container The DI container. |
235
|
|
|
* |
236
|
|
|
* @return AppCommands\Database\MigrateCommand |
237
|
|
|
* |
238
|
|
|
* @since 1.0 |
239
|
|
|
*/ |
240
|
1 |
|
public function getDatabaseMigrateCommandService(Container $container) |
241
|
|
|
{ |
242
|
1 |
|
$command = new AppCommands\Database\MigrateCommand($container->get(Migrations::class)); |
243
|
|
|
|
244
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
245
|
1 |
|
$command->setInput($container->get(Input::class)); |
246
|
1 |
|
$command->setLogger($container->get(LoggerInterface::class)); |
247
|
|
|
|
248
|
1 |
|
return $command; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* Get the Database\StatusCommand class service |
253
|
|
|
* |
254
|
|
|
* @param Container $container The DI container. |
255
|
|
|
* |
256
|
|
|
* @return AppCommands\Database\StatusCommand |
257
|
|
|
* |
258
|
|
|
* @since 1.0 |
259
|
|
|
*/ |
260
|
1 |
View Code Duplication |
public function getDatabaseStatusCommandService(Container $container) |
|
|
|
|
261
|
|
|
{ |
262
|
1 |
|
$command = new AppCommands\Database\StatusCommand($container->get(Migrations::class)); |
263
|
|
|
|
264
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
265
|
1 |
|
$command->setInput($container->get(Input::class)); |
266
|
|
|
|
267
|
1 |
|
return $command; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* Get the DisplayControllerGet class service |
272
|
|
|
* |
273
|
|
|
* @param Container $container The DI container. |
274
|
|
|
* |
275
|
|
|
* @return DisplayControllerGet |
276
|
|
|
* |
277
|
|
|
* @since 1.0 |
278
|
|
|
*/ |
279
|
1 |
View Code Duplication |
public function getDisplayControllerGetService(Container $container) |
|
|
|
|
280
|
|
|
{ |
281
|
1 |
|
$controller = new DisplayControllerGet( |
282
|
1 |
|
$container->get(StatsJsonView::class), |
283
|
1 |
|
$container->get(CacheItemPoolInterface::class) |
284
|
1 |
|
); |
285
|
|
|
|
286
|
1 |
|
$controller->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
287
|
1 |
|
$controller->setInput($container->get(Input::class)); |
288
|
|
|
|
289
|
1 |
|
return $controller; |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
/** |
293
|
|
|
* Get the HelpCommand class service |
294
|
|
|
* |
295
|
|
|
* @param Container $container The DI container. |
296
|
|
|
* |
297
|
|
|
* @return AppCommands\HelpCommand |
298
|
|
|
* |
299
|
|
|
* @since 1.0 |
300
|
|
|
*/ |
301
|
1 |
View Code Duplication |
public function getHelpCommandService(Container $container) |
|
|
|
|
302
|
|
|
{ |
303
|
1 |
|
$command = new AppCommands\HelpCommand; |
304
|
|
|
|
305
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
306
|
1 |
|
$command->setInput($container->get(Input::class)); |
307
|
|
|
|
308
|
1 |
|
return $command; |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* Get the Input\Cli class service |
313
|
|
|
* |
314
|
|
|
* @param Container $container The DI container. |
315
|
|
|
* |
316
|
|
|
* @return Cli |
317
|
|
|
* |
318
|
|
|
* @since 1.0 |
319
|
|
|
*/ |
320
|
1 |
|
public function getInputCliService(Container $container) |
|
|
|
|
321
|
|
|
{ |
322
|
1 |
|
return new Cli; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* Get the Input class service |
327
|
|
|
* |
328
|
|
|
* @param Container $container The DI container. |
329
|
|
|
* |
330
|
|
|
* @return Input |
331
|
|
|
* |
332
|
|
|
* @since 1.0 |
333
|
|
|
*/ |
334
|
1 |
|
public function getInputService(Container $container) |
|
|
|
|
335
|
|
|
{ |
336
|
1 |
|
return new Input($_REQUEST); |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* Get the InstallCommand class service |
341
|
|
|
* |
342
|
|
|
* @param Container $container The DI container. |
343
|
|
|
* |
344
|
|
|
* @return AppCommands\InstallCommand |
345
|
|
|
* |
346
|
|
|
* @since 1.0 |
347
|
|
|
*/ |
348
|
1 |
View Code Duplication |
public function getInstallCommandService(Container $container) |
|
|
|
|
349
|
|
|
{ |
350
|
1 |
|
$command = new AppCommands\InstallCommand($container->get(DatabaseDriver::class)); |
351
|
|
|
|
352
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
353
|
1 |
|
$command->setInput($container->get(Input::class)); |
354
|
|
|
|
355
|
1 |
|
return $command; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* Get the router service |
360
|
|
|
* |
361
|
|
|
* @param Container $container The DI container. |
362
|
|
|
* |
363
|
|
|
* @return Router |
364
|
|
|
* |
365
|
|
|
* @since 1.0 |
366
|
|
|
*/ |
367
|
1 |
|
public function getRouterService(Container $container) |
368
|
|
|
{ |
369
|
1 |
|
$router = (new Router($container->get(Input::class))) |
370
|
1 |
|
->setControllerPrefix('Stats\\Controllers\\') |
371
|
1 |
|
->setDefaultController('DisplayController') |
372
|
1 |
|
->addMap('/submit', 'SubmitController') |
373
|
1 |
|
->addMap('/:source', 'DisplayController'); |
374
|
|
|
|
375
|
1 |
|
$router->setContainer($container); |
376
|
|
|
|
377
|
1 |
|
return $router; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* Get the SnapshotCommand class service |
382
|
|
|
* |
383
|
|
|
* @param Container $container The DI container. |
384
|
|
|
* |
385
|
|
|
* @return AppCommands\SnapshotCommand |
386
|
|
|
* |
387
|
|
|
* @since 1.0 |
388
|
|
|
*/ |
389
|
1 |
View Code Duplication |
public function getSnapshotCommandService(Container $container) |
|
|
|
|
390
|
|
|
{ |
391
|
1 |
|
$command = new AppCommands\SnapshotCommand($container->get(StatsJsonView::class)); |
392
|
|
|
|
393
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
394
|
1 |
|
$command->setInput($container->get(Input::class)); |
395
|
|
|
|
396
|
1 |
|
return $command; |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* Get the StatsJsonView class service |
401
|
|
|
* |
402
|
|
|
* @param Container $container The DI container. |
403
|
|
|
* |
404
|
|
|
* @return StatsJsonView |
405
|
|
|
* |
406
|
|
|
* @since 1.0 |
407
|
|
|
*/ |
408
|
1 |
|
public function getStatsJsonViewService(Container $container) |
409
|
|
|
{ |
410
|
1 |
|
return new StatsJsonView( |
411
|
1 |
|
$container->get(StatsModel::class) |
412
|
1 |
|
); |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* Get the StatsModel class service |
417
|
|
|
* |
418
|
|
|
* @param Container $container The DI container. |
419
|
|
|
* |
420
|
|
|
* @return StatsModel |
421
|
|
|
* |
422
|
|
|
* @since 1.0 |
423
|
|
|
*/ |
424
|
1 |
|
public function getStatsModelService(Container $container) |
425
|
|
|
{ |
426
|
1 |
|
return new StatsModel( |
427
|
1 |
|
$container->get(DatabaseDriver::class) |
428
|
1 |
|
); |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
/** |
432
|
|
|
* Get the SubmitControllerCreate class service |
433
|
|
|
* |
434
|
|
|
* @param Container $container The DI container. |
435
|
|
|
* |
436
|
|
|
* @return SubmitControllerCreate |
437
|
|
|
* |
438
|
|
|
* @since 1.0 |
439
|
|
|
*/ |
440
|
1 |
View Code Duplication |
public function getSubmitControllerCreateService(Container $container) |
|
|
|
|
441
|
|
|
{ |
442
|
1 |
|
$controller = new SubmitControllerCreate( |
443
|
1 |
|
$container->get(StatsModel::class) |
444
|
1 |
|
); |
445
|
|
|
|
446
|
1 |
|
$controller->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
447
|
1 |
|
$controller->setInput($container->get(Input::class)); |
448
|
|
|
|
449
|
1 |
|
return $controller; |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* Get the SubmitControllerGet class service |
454
|
|
|
* |
455
|
|
|
* @param Container $container The DI container. |
456
|
|
|
* |
457
|
|
|
* @return SubmitControllerGet |
458
|
|
|
* |
459
|
|
|
* @since 1.0 |
460
|
|
|
*/ |
461
|
1 |
View Code Duplication |
public function getSubmitControllerGetService(Container $container) |
|
|
|
|
462
|
|
|
{ |
463
|
1 |
|
$controller = new SubmitControllerGet; |
464
|
|
|
|
465
|
1 |
|
$controller->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
466
|
1 |
|
$controller->setInput($container->get(Input::class)); |
467
|
|
|
|
468
|
1 |
|
return $controller; |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* Get the Tags\JoomlaCommand class service |
473
|
|
|
* |
474
|
|
|
* @param Container $container The DI container. |
475
|
|
|
* |
476
|
|
|
* @return AppCommands\Tags\JoomlaCommand |
477
|
|
|
* |
478
|
|
|
* @since 1.0 |
479
|
|
|
*/ |
480
|
1 |
View Code Duplication |
public function getTagsJoomlaCommandService(Container $container) |
|
|
|
|
481
|
|
|
{ |
482
|
1 |
|
$command = new AppCommands\Tags\JoomlaCommand($container->get(GitHub::class)); |
483
|
|
|
|
484
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
485
|
1 |
|
$command->setInput($container->get(Input::class)); |
486
|
|
|
|
487
|
1 |
|
return $command; |
488
|
|
|
} |
489
|
|
|
|
490
|
|
|
/** |
491
|
|
|
* Get the Tags\PhpCommand class service |
492
|
|
|
* |
493
|
|
|
* @param Container $container The DI container. |
494
|
|
|
* |
495
|
|
|
* @return AppCommands\Tags\PhpCommand |
496
|
|
|
* |
497
|
|
|
* @since 1.0 |
498
|
|
|
*/ |
499
|
1 |
View Code Duplication |
public function getTagsPhpCommandService(Container $container) |
|
|
|
|
500
|
|
|
{ |
501
|
1 |
|
$command = new AppCommands\Tags\PhpCommand($container->get(GitHub::class)); |
502
|
|
|
|
503
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
504
|
1 |
|
$command->setInput($container->get(Input::class)); |
505
|
|
|
|
506
|
1 |
|
return $command; |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
/** |
510
|
|
|
* Get the UpdateCommand class service |
511
|
|
|
* |
512
|
|
|
* @param Container $container The DI container. |
513
|
|
|
* |
514
|
|
|
* @return AppCommands\UpdateCommand |
515
|
|
|
* |
516
|
|
|
* @since 1.0 |
517
|
|
|
*/ |
518
|
1 |
View Code Duplication |
public function getUpdateCommandService(Container $container) |
|
|
|
|
519
|
|
|
{ |
520
|
1 |
|
$command = new AppCommands\UpdateCommand; |
521
|
|
|
|
522
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
523
|
1 |
|
$command->setInput($container->get(Input::class)); |
524
|
|
|
|
525
|
1 |
|
return $command; |
526
|
|
|
} |
527
|
|
|
|
528
|
|
|
/** |
529
|
|
|
* Get the web application service |
530
|
|
|
* |
531
|
|
|
* @param Container $container The DI container. |
532
|
|
|
* |
533
|
|
|
* @return WebApplication |
534
|
|
|
* |
535
|
|
|
* @since 1.0 |
536
|
|
|
*/ |
537
|
1 |
|
public function getWebApplicationService(Container $container) |
538
|
|
|
{ |
539
|
1 |
|
$application = new WebApplication($container->get(Input::class), $container->get('config')); |
540
|
|
|
|
541
|
|
|
// Inject extra services |
542
|
1 |
|
$application->setAnalytics($container->get(Analytics::class)); |
543
|
1 |
|
$application->setLogger($container->get('monolog.logger.application')); |
544
|
1 |
|
$application->setRouter($container->get(Router::class)); |
545
|
|
|
|
546
|
1 |
|
return $application; |
547
|
|
|
} |
548
|
|
|
} |
549
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.