Completed
Push — master ( ef0fd6...cd5669 )
by Jeroen
04:24
created

AbstractKernel::loadEnvironment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Protoku\Kernel;
4
5
use Dotenv\Dotenv;
6
use League\BooBoo\Formatter\JsonFormatter;
7
use League\BooBoo\Runner;
8
use League\Container\Container;
9
use League\Container\ContainerAwareTrait;
10
use League\Container\ReflectionContainer;
11
12
abstract class AbstractKernel
13
{
14
    use ContainerAwareTrait;
15
16
    /**
17
     * AbstractKernel constructor.
18
     */
19
    public function __construct()
20
    {
21
    	$this->createErrorHandler();
22
23
    	$this->createContainer();
24
25
    	$this->loadEnvironment();
26
    }
27
28
    private function createErrorHandler()
29
	{
30
		$runner = new Runner(new JsonFormatter);
0 ignored issues
show
Documentation introduced by
new \League\BooBoo\Formatter\JsonFormatter() is of type object<League\BooBoo\Formatter\JsonFormatter>, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
31
		$runner->register();
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