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

Application::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 14
ccs 0
cts 2
cp 0
rs 9.4285
cc 1
eloc 1
nc 1
nop 0
crap 2
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