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) : AppCommands\Cache\ClearCommand |
|
|
|
|
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) : CliApplication |
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
|
|
|
); |
151
|
|
|
|
152
|
|
|
// Inject extra services |
153
|
1 |
|
$application->setLogger($container->get('monolog.logger.cli')); |
154
|
|
|
|
155
|
1 |
|
return $application; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Get the CliInput class service |
160
|
|
|
* |
161
|
|
|
* @param Container $container The DI container. |
162
|
|
|
* |
163
|
|
|
* @return JoomlaApplication\Cli\CliInput |
164
|
|
|
* |
165
|
|
|
* @since 1.0 |
166
|
|
|
*/ |
167
|
1 |
|
public function getCliInputService(Container $container) : JoomlaApplication\Cli\CliInput |
|
|
|
|
168
|
|
|
{ |
169
|
1 |
|
return new JoomlaApplication\Cli\CliInput; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* Get the CliOutput class service |
174
|
|
|
* |
175
|
|
|
* @param Container $container The DI container. |
176
|
|
|
* |
177
|
|
|
* @return JoomlaApplication\Cli\CliOutput |
178
|
|
|
* |
179
|
|
|
* @since 1.0 |
180
|
|
|
*/ |
181
|
1 |
|
public function getCliOutputService(Container $container) : JoomlaApplication\Cli\Output\Stdout |
182
|
|
|
{ |
183
|
1 |
|
return new JoomlaApplication\Cli\Output\Stdout($container->get(JoomlaApplication\Cli\Output\Processor\ColorProcessor::class)); |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Get the ColorProcessor class service |
188
|
|
|
* |
189
|
|
|
* @param Container $container The DI container. |
190
|
|
|
* |
191
|
|
|
* @return JoomlaApplication\Cli\Output\Processor\ColorProcessor |
192
|
|
|
* |
193
|
|
|
* @since 1.0 |
194
|
|
|
*/ |
195
|
1 |
|
public function getColorProcessorService(Container $container) : JoomlaApplication\Cli\Output\Processor\ColorProcessor |
196
|
|
|
{ |
197
|
1 |
|
$processor = new JoomlaApplication\Cli\Output\Processor\ColorProcessor; |
198
|
|
|
|
199
|
|
|
/** @var Input $input */ |
200
|
1 |
|
$input = $container->get(Cli::class); |
201
|
|
|
|
202
|
1 |
|
if ($input->getBool('nocolors', false)) |
203
|
|
|
{ |
204
|
|
|
$processor->noColors = true; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
// Setup app colors (also required in "nocolors" mode - to strip them). |
208
|
1 |
|
$processor->addStyle('title', new JoomlaApplication\Cli\ColorStyle('yellow', '', ['bold'])); |
209
|
|
|
|
210
|
1 |
|
return $processor; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* Get the console service |
215
|
|
|
* |
216
|
|
|
* @param Container $container The DI container. |
217
|
|
|
* |
218
|
|
|
* @return Console |
219
|
|
|
* |
220
|
|
|
* @since 1.0 |
221
|
|
|
*/ |
222
|
1 |
|
public function getConsoleService(Container $container) : Console |
223
|
|
|
{ |
224
|
1 |
|
$console = new Console; |
225
|
1 |
|
$console->setContainer($container); |
226
|
|
|
|
227
|
1 |
|
return $console; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* Get the Database\MigrateCommand class service |
232
|
|
|
* |
233
|
|
|
* @param Container $container The DI container. |
234
|
|
|
* |
235
|
|
|
* @return AppCommands\Database\MigrateCommand |
236
|
|
|
* |
237
|
|
|
* @since 1.0 |
238
|
|
|
*/ |
239
|
1 |
|
public function getDatabaseMigrateCommandService(Container $container) : AppCommands\Database\MigrateCommand |
240
|
|
|
{ |
241
|
1 |
|
$command = new AppCommands\Database\MigrateCommand($container->get(Migrations::class)); |
242
|
|
|
|
243
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
244
|
1 |
|
$command->setInput($container->get(Input::class)); |
245
|
1 |
|
$command->setLogger($container->get(LoggerInterface::class)); |
246
|
|
|
|
247
|
1 |
|
return $command; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* Get the Database\StatusCommand class service |
252
|
|
|
* |
253
|
|
|
* @param Container $container The DI container. |
254
|
|
|
* |
255
|
|
|
* @return AppCommands\Database\StatusCommand |
256
|
|
|
* |
257
|
|
|
* @since 1.0 |
258
|
|
|
*/ |
259
|
1 |
View Code Duplication |
public function getDatabaseStatusCommandService(Container $container) : AppCommands\Database\StatusCommand |
|
|
|
|
260
|
|
|
{ |
261
|
1 |
|
$command = new AppCommands\Database\StatusCommand($container->get(Migrations::class)); |
262
|
|
|
|
263
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
264
|
1 |
|
$command->setInput($container->get(Input::class)); |
265
|
|
|
|
266
|
1 |
|
return $command; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* Get the DisplayControllerGet class service |
271
|
|
|
* |
272
|
|
|
* @param Container $container The DI container. |
273
|
|
|
* |
274
|
|
|
* @return DisplayControllerGet |
275
|
|
|
* |
276
|
|
|
* @since 1.0 |
277
|
|
|
*/ |
278
|
1 |
View Code Duplication |
public function getDisplayControllerGetService(Container $container) : DisplayControllerGet |
|
|
|
|
279
|
|
|
{ |
280
|
1 |
|
$controller = new DisplayControllerGet( |
281
|
1 |
|
$container->get(StatsJsonView::class), |
282
|
1 |
|
$container->get(CacheItemPoolInterface::class) |
283
|
|
|
); |
284
|
|
|
|
285
|
1 |
|
$controller->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
286
|
1 |
|
$controller->setInput($container->get(Input::class)); |
287
|
|
|
|
288
|
1 |
|
return $controller; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* Get the HelpCommand class service |
293
|
|
|
* |
294
|
|
|
* @param Container $container The DI container. |
295
|
|
|
* |
296
|
|
|
* @return AppCommands\HelpCommand |
297
|
|
|
* |
298
|
|
|
* @since 1.0 |
299
|
|
|
*/ |
300
|
1 |
View Code Duplication |
public function getHelpCommandService(Container $container) : AppCommands\HelpCommand |
|
|
|
|
301
|
|
|
{ |
302
|
1 |
|
$command = new AppCommands\HelpCommand; |
303
|
|
|
|
304
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
305
|
1 |
|
$command->setInput($container->get(Input::class)); |
306
|
|
|
|
307
|
1 |
|
return $command; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* Get the Input\Cli class service |
312
|
|
|
* |
313
|
|
|
* @param Container $container The DI container. |
314
|
|
|
* |
315
|
|
|
* @return Cli |
316
|
|
|
* |
317
|
|
|
* @since 1.0 |
318
|
|
|
*/ |
319
|
1 |
|
public function getInputCliService(Container $container) : Cli |
|
|
|
|
320
|
|
|
{ |
321
|
1 |
|
return new Cli; |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* Get the Input class service |
326
|
|
|
* |
327
|
|
|
* @param Container $container The DI container. |
328
|
|
|
* |
329
|
|
|
* @return Input |
330
|
|
|
* |
331
|
|
|
* @since 1.0 |
332
|
|
|
*/ |
333
|
1 |
|
public function getInputService(Container $container) : Input |
|
|
|
|
334
|
|
|
{ |
335
|
1 |
|
return new Input($_REQUEST); |
336
|
|
|
} |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* Get the InstallCommand class service |
340
|
|
|
* |
341
|
|
|
* @param Container $container The DI container. |
342
|
|
|
* |
343
|
|
|
* @return AppCommands\InstallCommand |
344
|
|
|
* |
345
|
|
|
* @since 1.0 |
346
|
|
|
*/ |
347
|
1 |
View Code Duplication |
public function getInstallCommandService(Container $container) : AppCommands\InstallCommand |
|
|
|
|
348
|
|
|
{ |
349
|
1 |
|
$command = new AppCommands\InstallCommand($container->get(DatabaseDriver::class)); |
350
|
|
|
|
351
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
352
|
1 |
|
$command->setInput($container->get(Input::class)); |
353
|
|
|
|
354
|
1 |
|
return $command; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* Get the router service |
359
|
|
|
* |
360
|
|
|
* @param Container $container The DI container. |
361
|
|
|
* |
362
|
|
|
* @return Router |
363
|
|
|
* |
364
|
|
|
* @since 1.0 |
365
|
|
|
*/ |
366
|
1 |
|
public function getRouterService(Container $container) : Router |
367
|
|
|
{ |
368
|
1 |
|
$router = (new Router($container->get(Input::class))) |
369
|
1 |
|
->setControllerPrefix('Stats\\Controllers\\') |
370
|
1 |
|
->setDefaultController('DisplayController') |
371
|
1 |
|
->addMap('/submit', 'SubmitController') |
372
|
1 |
|
->addMap('/:source', 'DisplayController'); |
373
|
|
|
|
374
|
1 |
|
$router->setContainer($container); |
375
|
|
|
|
376
|
1 |
|
return $router; |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
/** |
380
|
|
|
* Get the SnapshotCommand class service |
381
|
|
|
* |
382
|
|
|
* @param Container $container The DI container. |
383
|
|
|
* |
384
|
|
|
* @return AppCommands\SnapshotCommand |
385
|
|
|
* |
386
|
|
|
* @since 1.0 |
387
|
|
|
*/ |
388
|
1 |
View Code Duplication |
public function getSnapshotCommandService(Container $container) : AppCommands\SnapshotCommand |
|
|
|
|
389
|
|
|
{ |
390
|
1 |
|
$command = new AppCommands\SnapshotCommand($container->get(StatsJsonView::class)); |
391
|
|
|
|
392
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
393
|
1 |
|
$command->setInput($container->get(Input::class)); |
394
|
|
|
|
395
|
1 |
|
return $command; |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* Get the StatsJsonView class service |
400
|
|
|
* |
401
|
|
|
* @param Container $container The DI container. |
402
|
|
|
* |
403
|
|
|
* @return StatsJsonView |
404
|
|
|
* |
405
|
|
|
* @since 1.0 |
406
|
|
|
*/ |
407
|
1 |
|
public function getStatsJsonViewService(Container $container) : StatsJsonView |
408
|
|
|
{ |
409
|
1 |
|
return new StatsJsonView( |
410
|
1 |
|
$container->get(StatsModel::class) |
411
|
|
|
); |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* Get the StatsModel class service |
416
|
|
|
* |
417
|
|
|
* @param Container $container The DI container. |
418
|
|
|
* |
419
|
|
|
* @return StatsModel |
420
|
|
|
* |
421
|
|
|
* @since 1.0 |
422
|
|
|
*/ |
423
|
1 |
|
public function getStatsModelService(Container $container) : StatsModel |
424
|
|
|
{ |
425
|
1 |
|
return new StatsModel( |
426
|
1 |
|
$container->get(DatabaseDriver::class) |
427
|
|
|
); |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
/** |
431
|
|
|
* Get the SubmitControllerCreate class service |
432
|
|
|
* |
433
|
|
|
* @param Container $container The DI container. |
434
|
|
|
* |
435
|
|
|
* @return SubmitControllerCreate |
436
|
|
|
* |
437
|
|
|
* @since 1.0 |
438
|
|
|
*/ |
439
|
1 |
View Code Duplication |
public function getSubmitControllerCreateService(Container $container) : SubmitControllerCreate |
|
|
|
|
440
|
|
|
{ |
441
|
1 |
|
$controller = new SubmitControllerCreate( |
442
|
1 |
|
$container->get(StatsModel::class) |
443
|
|
|
); |
444
|
|
|
|
445
|
1 |
|
$controller->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
446
|
1 |
|
$controller->setInput($container->get(Input::class)); |
447
|
|
|
|
448
|
1 |
|
return $controller; |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* Get the SubmitControllerGet class service |
453
|
|
|
* |
454
|
|
|
* @param Container $container The DI container. |
455
|
|
|
* |
456
|
|
|
* @return SubmitControllerGet |
457
|
|
|
* |
458
|
|
|
* @since 1.0 |
459
|
|
|
*/ |
460
|
1 |
View Code Duplication |
public function getSubmitControllerGetService(Container $container) : SubmitControllerGet |
|
|
|
|
461
|
|
|
{ |
462
|
1 |
|
$controller = new SubmitControllerGet; |
463
|
|
|
|
464
|
1 |
|
$controller->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
465
|
1 |
|
$controller->setInput($container->get(Input::class)); |
466
|
|
|
|
467
|
1 |
|
return $controller; |
468
|
|
|
} |
469
|
|
|
|
470
|
|
|
/** |
471
|
|
|
* Get the Tags\JoomlaCommand class service |
472
|
|
|
* |
473
|
|
|
* @param Container $container The DI container. |
474
|
|
|
* |
475
|
|
|
* @return AppCommands\Tags\JoomlaCommand |
476
|
|
|
* |
477
|
|
|
* @since 1.0 |
478
|
|
|
*/ |
479
|
1 |
View Code Duplication |
public function getTagsJoomlaCommandService(Container $container) : AppCommands\Tags\JoomlaCommand |
|
|
|
|
480
|
|
|
{ |
481
|
1 |
|
$command = new AppCommands\Tags\JoomlaCommand($container->get(GitHub::class)); |
482
|
|
|
|
483
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
484
|
1 |
|
$command->setInput($container->get(Input::class)); |
485
|
|
|
|
486
|
1 |
|
return $command; |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
/** |
490
|
|
|
* Get the Tags\PhpCommand class service |
491
|
|
|
* |
492
|
|
|
* @param Container $container The DI container. |
493
|
|
|
* |
494
|
|
|
* @return AppCommands\Tags\PhpCommand |
495
|
|
|
* |
496
|
|
|
* @since 1.0 |
497
|
|
|
*/ |
498
|
1 |
View Code Duplication |
public function getTagsPhpCommandService(Container $container) : AppCommands\Tags\PhpCommand |
|
|
|
|
499
|
|
|
{ |
500
|
1 |
|
$command = new AppCommands\Tags\PhpCommand($container->get(GitHub::class)); |
501
|
|
|
|
502
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
503
|
1 |
|
$command->setInput($container->get(Input::class)); |
504
|
|
|
|
505
|
1 |
|
return $command; |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
/** |
509
|
|
|
* Get the UpdateCommand class service |
510
|
|
|
* |
511
|
|
|
* @param Container $container The DI container. |
512
|
|
|
* |
513
|
|
|
* @return AppCommands\UpdateCommand |
514
|
|
|
* |
515
|
|
|
* @since 1.0 |
516
|
|
|
*/ |
517
|
1 |
View Code Duplication |
public function getUpdateCommandService(Container $container) : AppCommands\UpdateCommand |
|
|
|
|
518
|
|
|
{ |
519
|
1 |
|
$command = new AppCommands\UpdateCommand; |
520
|
|
|
|
521
|
1 |
|
$command->setApplication($container->get(JoomlaApplication\AbstractApplication::class)); |
522
|
1 |
|
$command->setInput($container->get(Input::class)); |
523
|
|
|
|
524
|
1 |
|
return $command; |
525
|
|
|
} |
526
|
|
|
|
527
|
|
|
/** |
528
|
|
|
* Get the web application service |
529
|
|
|
* |
530
|
|
|
* @param Container $container The DI container. |
531
|
|
|
* |
532
|
|
|
* @return WebApplication |
533
|
|
|
* |
534
|
|
|
* @since 1.0 |
535
|
|
|
*/ |
536
|
1 |
|
public function getWebApplicationService(Container $container) : WebApplication |
537
|
|
|
{ |
538
|
1 |
|
$application = new WebApplication($container->get(Input::class), $container->get('config')); |
539
|
|
|
|
540
|
|
|
// Inject extra services |
541
|
1 |
|
$application->setAnalytics($container->get(Analytics::class)); |
542
|
1 |
|
$application->setLogger($container->get('monolog.logger.application')); |
543
|
1 |
|
$application->setRouter($container->get(Router::class)); |
544
|
|
|
|
545
|
1 |
|
return $application; |
546
|
|
|
} |
547
|
|
|
} |
548
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.