Completed
Push — master ( 3f142b )
by Emlyn
04:09 queued 02:37
created

Application   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 85.71%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 51
ccs 12
cts 14
cp 0.8571
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 4 1
A __construct() 0 12 1
A setDependencyContainer() 0 4 1
A getDependencyContainer() 0 4 1
A run() 0 14 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 4
	public static function init(array $config) : Application
26
	{
27 4
		return new static($config);
28
	}
29
30 4
	public function __construct(array $config, ContainerInterface $dependencyContainer = null)
31
	{
32 4
		$this->setDependencyContainer($dependencyContainer ?? new Container($config));
33 4
		$this->dependencyContainer->add('fuel.application', $this);
34 4
		$this->dependencyContainer->addServiceProvider(new ApplicationServicesProvider());
35
36
		// TODO: register any events from the config
37
38
		// TODO: Load components
39
40
		// TODO: trigger app created event
41 4
	}
42
43 4
	public function setDependencyContainer(ContainerInterface $dependencyContainer)
44
	{
45 4
		$this->dependencyContainer = $dependencyContainer;
46 4
	}
47
48 4
	public function getDependencyContainer() : ContainerInterface
49
	{
50 4
		return $this->dependencyContainer;
51
	}
52
53
	public function run()
54
	{
55
		// TODO: trigger request started event
56
57
		// TODO: route to and call controller
58
59
		// TODO: trigger request ended event
60
61
		// TODO: trigger response started event
62
63
		// TODO: generate and send response
64
65
		// TODO: send shutdown event
66
	}
67
68
}
69