AbstractKernel::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 6
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Protoku\Kernel;
4
5
use Dotenv\Dotenv;
6
use League\Container\Container;
7
use League\Container\ContainerAwareTrait;
8
use League\Container\ReflectionContainer;
9
use Protoku\Exceptions\Formatters\DefaultFormatter;
10
use Protoku\Exceptions\Handler;
11
12
abstract class AbstractKernel
13
{
14
    use ContainerAwareTrait;
15
16
    /**
17
     * AbstractKernel constructor.
18
     */
19
    public function __construct()
20
    {
21
    	$this->registerExceptionHandler();
22
23
    	$this->createContainer();
24
25
    	$this->loadEnvironment();
26
    }
27
28
    private function registerExceptionHandler()
29
	{
30
		$handler = new Handler(new DefaultFormatter());
0 ignored issues
show
Unused Code introduced by
$handler is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
31
32
	}
33
34
    private function createContainer()
35
	{
36
		$container = new Container;
37
		$container->delegate(new ReflectionContainer);
38
		$this->setContainer($container);
39
	}
40
41
	private function loadEnvironment()
42
	{
43
		$environment = new Dotenv(getcwd() . '/../');
44
		$environment->load();
45
	}
46
}
47