Completed
Push — master ( 9a3a3c...24148b )
by Michael
14s
created

ConsoleKernel::buildContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 19
Ratio 100 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
dl 19
loc 19
ccs 10
cts 10
cp 1
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Joomla! Statistics Server
4
 *
5
 * @copyright  Copyright (C) 2013 - 2017 Open Source Matters, Inc. All rights reserved.
6
 * @license    http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License Version 2 or Later
7
 */
8
9
namespace Joomla\StatsServer\Kernel;
10
11
use Joomla\Application\AbstractApplication;
12
use Joomla\Console\Application;
13
use Joomla\DI\Container;
14
use Joomla\StatsServer\Kernel;
15
use Monolog\Logger;
16
use Psr\Log\LoggerInterface;
17
18
/**
19
 * Console application kernel
20
 */
21 View Code Duplication
class ConsoleKernel extends Kernel
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
{
23
	/**
24
	 * Build the service container
25
	 *
26
	 * @return  void
27
	 */
28 1
	protected function buildContainer(): Container
29
	{
30 1
		$container = parent::buildContainer();
31
32
		// Alias the web application to Joomla's base application class as this is the primary application for the environment
33 1
		$container->alias(AbstractApplication::class, Application::class);
34
35
		// Alias the web application logger as the primary logger for the environment
36 1
		$container->alias('monolog', 'monolog.logger.cli')
37 1
			->alias('logger', 'monolog.logger.cli')
38 1
			->alias(Logger::class, 'monolog.logger.cli')
39 1
			->alias(LoggerInterface::class, 'monolog.logger.cli');
40
41
		// Set error reporting based on config
42 1
		$errorReporting = (int) $container->get('config')->get('errorReporting', 0);
43 1
		error_reporting($errorReporting);
44
45 1
		return $container;
46
	}
47
}
48