HttpClientServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 1
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: lenovo
5
 * Date: 6/15/2018
6
 * Time: 12:14 AM
7
 */
8
9
namespace TimSDK\Foundation\ServiceProviders;
10
11
use GuzzleHttp\Client;
12
use Pimple\Container;
13
14
class HttpClientServiceProvider extends ServiceProvider
15
{
16
17
    /**
18
     * Registers services on the given container.
19
     *
20
     * This method should only be used to configure services and parameters.
21
     * It should not get services.
22
     *
23
     * @param Container $pimple A container instance
24
     */
25
    public function register(Container $pimple)
26
    {
27
        $pimple['httpClient'] = $pimple[Client::class] = function ($app) {
28
            return new Client(array_merge($app['config']->get('http', []), [
29
                'verify' => realpath($app['path.cert'] . '/cacert.pem')
30
            ]));
31
        };
32
    }
33
}
34