1 | <?php |
||
22 | class ApplicationServicesProvider extends AbstractServiceProvider |
||
23 | { |
||
24 | |||
25 | protected $provides = [ |
||
26 | 'fuel.application.event', |
||
27 | |||
28 | 'fuel.application.request', |
||
29 | 'Fuel\Foundation\Request\Cli', |
||
30 | 'Fuel\Foundation\Request\Http', |
||
31 | |||
32 | 'fuel.application.response', |
||
33 | 'Fuel\Foundation\Response\Cli', |
||
34 | 'Fuel\Foundation\Response\Http', |
||
35 | |||
36 | 'fuel.application.finder', |
||
37 | |||
38 | 'fuel.config', |
||
39 | |||
40 | 'fuel.application.component_manager', |
||
41 | |||
42 | 'fuel.application.router', |
||
43 | ]; |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 10 | public function register() |
|
49 | { |
||
50 | 10 | $this->getContainer()->add('fuel.application.event', 'League\Event\Emitter', true); |
|
51 | |||
52 | 10 | $this->getContainer()->add('Fuel\Foundation\Request\Cli', 'Fuel\Foundation\Request\Cli', false); |
|
53 | 10 | $this->getContainer()->add('Fuel\Foundation\Request\Http', Http::forge(), false); |
|
54 | 10 | $this->getContainer()->add('fuel.application.request', $this->constructRequest(), true); |
|
55 | |||
56 | 10 | $this->getContainer()->add('Fuel\Foundation\Response\Cli', 'Fuel\Foundation\Response\Cli', false); |
|
57 | 10 | $this->getContainer()->add('Fuel\Foundation\Response\Http', 'Fuel\Foundation\Response\Http', false); |
|
58 | 10 | $this->getContainer()->add('fuel.application.response', $this->constructResponse(), true); |
|
59 | |||
60 | 10 | $this->getContainer()->add('fuel.application.finder', 'Fuel\FileSystem\Finder', true); |
|
61 | |||
62 | // Also create a config container for our services |
||
63 | 10 | $this->getContainer()->add('fuel.config', new Container(null, $this->getContainer()->get('fuel.application.finder')), true); |
|
64 | |||
65 | 10 | $this->getContainer()->add('fuel.application.component_manager', $this->constructComponentManager(), true); |
|
66 | |||
67 | 10 | $this->getContainer()->add('fuel.application.router', $this->constructRouter(), true); |
|
68 | 10 | } |
|
69 | |||
70 | /** |
||
71 | * @return Router |
||
72 | */ |
||
73 | 10 | protected function constructRouter() : Router |
|
82 | |||
83 | 10 | protected function constructComponentManager() : ComponentManager |
|
87 | |||
88 | /** |
||
89 | * @return RequestInterface |
||
90 | */ |
||
91 | 10 | protected function constructRequest() : RequestInterface |
|
99 | |||
100 | /** |
||
101 | * @return ResponseInterface |
||
102 | */ |
||
103 | 10 | protected function constructResponse() : ResponseInterface |
|
111 | |||
112 | /** |
||
113 | * @return bool |
||
114 | */ |
||
115 | 10 | public function isCli() : bool |
|
119 | } |
||
120 |