Completed
Push — master ( dc4ad7...0cb618 )
by Steve
05:13 queued 03:11
created

constructComponentManager()   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 0
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\Foundation\Request\RequestInterface;
16
use Fuel\Foundation\Response\ResponseInterface;
17
use League\Container\ServiceProvider;
18
19
class ApplicationServicesProvider extends ServiceProvider
20
{
21
22
	protected $provides = [
23
		'fuel.application.event',
24
25
		'fuel.application.request',
26
		'Fuel\Foundation\Request\Cli',
27
28
		'fuel.application.response',
29
		'Fuel\Foundation\Response\Cli',
30
31
		'fuel.application.component_manager',
32
	];
33
34
	/**
35
	 * {@inheritdoc}
36
	 */
37 6
	public function register()
38
	{
39 6
		$this->getContainer()->add('fuel.application.event', 'League\Event\Emitter', true);
40
41 6
		$this->getContainer()->add('Fuel\Foundation\Request\Cli', 'Fuel\Foundation\Request\Cli', false);
42 6
		$this->getContainer()->add('fuel.application.request', $this->constructRequest(), true);
43
44 6
		$this->getContainer()->add('Fuel\Foundation\Response\Cli', 'Fuel\Foundation\Response\Cli', false);
45 6
		$this->getContainer()->add('fuel.application.response', $this->constructResponse(), true);
46
47 6
		$this->getContainer()->add('fuel.application.component_manager', $this->constructComponentManager(), true);
48 6
	}
49
50 6
	protected function constructComponentManager()
51
	{
52 6
		return new ComponentManager($this->getContainer()->get('fuel.config'));
53
	}
54
55
	/**
56
	 * @return RequestInterface
57
	 */
58 6
	protected function constructRequest() : RequestInterface
59
	{
60
		// TODO: perform an actual check to see what kind of request we are dealing with!
61 6
		return $this->getContainer()->get('Fuel\Foundation\Request\Cli');
62
	}
63
64
	/**
65
	 * @return ResponseInterface
66
	 */
67 6
	protected function constructResponse() : ResponseInterface
68
	{
69
		// TODO: perform an actual check to see what kind of request we are dealing with!
70 6
		return $this->getContainer()->get('Fuel\Foundation\Response\Cli');
71
	}
72
}
73