Completed
Push — master ( f4b826...4d0daa )
by Chris
04:52 queued 02:17
created

HttpService::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
namespace Darya\Foundation\Providers;
3
4
use Darya\Http\Request;
5
use Darya\Http\Session\Php as PhpSession;
6
use Darya\Service\Contracts\Container;
7
use Darya\Service\Contracts\Provider;
8
9
/**
10
 * A service provider that provides HTTP request and response objects.
11
 * 
12
 * @author Chris Andrew <[email protected]>
13
 */
14
class HttpService implements Provider
15
{
16
    public function register(Container $container)
17
    {
18
		$container->register(array(
19
            'Darya\Http\Request' => function ($container) {
20
                return Request::createFromGlobals($container->resolve('Darya\Http\Session'));
21
            },
22
            'Darya\Http\Session' => new PhpSession
23
        ));
24
    }
25
}
26