Completed
Push — master ( c3f7f6...458bfd )
by Changwan
02:39
created

GuzzleServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
ccs 0
cts 5
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace Wandu\Service\GuzzleHttp;
3
4
use GuzzleHttp\Client;
5
use GuzzleHttp\ClientInterface;
6
use Wandu\Config\Contracts\Config;
7
use Wandu\DI\ContainerInterface;
8
use Wandu\DI\ServiceProvider;
9
10
class GuzzleServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function register(ContainerInterface $app)
16
    {
17
        $app->bind(Client::class, function (Config $config) {
18
            return new Client($config->get('guzzlehttp.guzzle', []));
19
        });
20
        $app->alias(ClientInterface::class, Client::class);
21
    }
22
}
23