Completed
Push — new_master ( 14eebe...a8bdf5 )
by Emlyn
05:48
created

Application::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * @package    Fuel\Foundation
4
 * @version    2.0
5
 * @author     Fuel Development Team
6
 * @license    MIT License
7
 * @copyright  2010 - 2016 Fuel Development Team
8
 * @link       http://fuelphp.com
9
 */
10
11
declare(strict_types=1);
12
13
namespace Fuel\Foundation;
14
15
use Fuel\Dependency\Container;
16
use League\Container\ContainerInterface;
17
18
class Application
19
{
20
	/**
21
	 * @var ContainerInterface
22
	 */
23
	protected $dependencyContainer;
24
25 2
	public static function init(array $config) : Application
26
	{
27 2
		return new static($config);
28
	}
29
30 2
	public function __construct(array $config, ContainerInterface $dependencyContainer = null)
31
	{
32 2
		$this->setDependencyContainer($dependencyContainer ?? new Container($config));
33 2
		$this->dependencyContainer->add('fuel.application', $this);
34 2
		$this->dependencyContainer->addServiceProvider(new ApplicationServicesProvider());
35 2
	}
36
37 2
	public function setDependencyContainer(ContainerInterface $dependencyContainer)
38
	{
39 2
		$this->dependencyContainer = $dependencyContainer;
40 2
	}
41
42 2
	public function getDependencyContainer() : ContainerInterface
43
	{
44 2
		return $this->dependencyContainer;
45
	}
46
47
}
48