IMCloudServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 15 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: lenovo
5
 * Date: 6/14/2018
6
 * Time: 8:58 PM
7
 */
8
9
namespace TimSDK\Core\ServiceProviders;
10
11
use Pimple\Container;
12
use TimSDK\Core\IMCloud;
13
use TimSDK\Core\TLSSig;
14
use TimSDK\Foundation\ServiceProviders\ServiceProvider;
15
16
class IMCloudServiceProvider extends ServiceProvider
17
{
18
    /**
19
     * Registers services on the given container.
20
     *
21
     * This method should only be used to configure services and parameters.
22
     * It should not get services.
23
     *
24
     * @param Container $pimple A container instance
25
     */
26
    public function register(Container $pimple)
27
    {
28
        $pimple[IMCloud::class] = $pimple['im'] = function ($app) {
29
            return new IMCloud($app);
30
        };
31
32
        $pimple[TLSSig::class] = $pimple['TLSSig'] = function ($app) {
33
            $api = new TLSSig();
34
            $api->setAppid($app['config']->get('app_id'));
35
            $api->setPrivateKey($app['config']->get('private_key'));
36
            $api->setPublicKey($app['config']->get('public_key'));
37
38
            return $api;
39
        };
40
    }
41
}
42