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

ApplicationServicesProvider::constructResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 9.4285
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
32
	/**
33
	 * {@inheritdoc}
34
	 */
35 3
	public function register()
36
	{
37 3
		$this->getContainer()->add('fuel.application.event', 'Fuel\Event\Container', true);
38
39 3
		$this->getContainer()->add('Fuel\Foundation\Request\Cli', 'Fuel\Foundation\Request\Cli', false);
40 3
		$this->getContainer()->add('fuel.application.request', $this->constructRequest(), true);
41
42 3
		$this->getContainer()->add('Fuel\Foundation\Response\Cli', 'Fuel\Foundation\Response\Cli', false);
43 3
		$this->getContainer()->add('fuel.application.response', $this->constructResponse(), true);
44 3
	}
45
46
	/**
47
	 * @return RequestInterface
48
	 */
49 3
	protected function constructRequest() : RequestInterface
50
	{
51
		// TODO: perform an actual check to see what kind of request we are dealing with!
52 3
		return $this->getContainer()->get('Fuel\Foundation\Request\Cli');
53
	}
54
55
	/**
56
	 * @return ResponseInterface
57
	 */
58 3
	protected function constructResponse() : ResponseInterface
59
	{
60
		// TODO: perform an actual check to see what kind of request we are dealing with!
61 3
		return $this->getContainer()->get('Fuel\Foundation\Response\Cli');
62
	}
63
}
64