Code Duplication    Length = 27-27 lines in 2 locations

src/Kernel/ConsoleKernel.php 1 location

@@ 21-47 (lines=27) @@
18
/**
19
 * Console application kernel
20
 */
21
class ConsoleKernel extends Kernel
22
{
23
	/**
24
	 * Build the service container
25
	 *
26
	 * @return  void
27
	 */
28
	protected function buildContainer(): Container
29
	{
30
		$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
		$container->alias(AbstractApplication::class, Application::class);
34
35
		// Alias the web application logger as the primary logger for the environment
36
		$container->alias('monolog', 'monolog.logger.cli')
37
			->alias('logger', 'monolog.logger.cli')
38
			->alias(Logger::class, 'monolog.logger.cli')
39
			->alias(LoggerInterface::class, 'monolog.logger.cli');
40
41
		// Set error reporting based on config
42
		$errorReporting = (int) $container->get('config')->get('errorReporting', 0);
43
		error_reporting($errorReporting);
44
45
		return $container;
46
	}
47
}
48

src/Kernel/WebKernel.php 1 location

@@ 21-47 (lines=27) @@
18
/**
19
 * Web application kernel
20
 */
21
class WebKernel extends Kernel
22
{
23
	/**
24
	 * Build the service container
25
	 *
26
	 * @return  void
27
	 */
28
	protected function buildContainer(): Container
29
	{
30
		$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
		$container->alias(AbstractApplication::class, AbstractWebApplication::class);
34
35
		// Alias the web application logger as the primary logger for the environment
36
		$container->alias('monolog', 'monolog.logger.application')
37
			->alias('logger', 'monolog.logger.application')
38
			->alias(Logger::class, 'monolog.logger.application')
39
			->alias(LoggerInterface::class, 'monolog.logger.application');
40
41
		// Set error reporting based on config
42
		$errorReporting = (int) $container->get('config')->get('errorReporting', 0);
43
		error_reporting($errorReporting);
44
45
		return $container;
46
	}
47
}
48