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

Application   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 30
ccs 12
cts 12
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 4 1
A __construct() 0 6 1
A setDependencyContainer() 0 4 1
A getDependencyContainer() 0 4 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