OAuthServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 17 1
1
<?php
2
3
namespace YEntWeChat\Foundation\ServiceProviders;
4
5
use YEntWeChat\Auth\App;
6
use YEntWeChat\Auth\Web;
7
use YEntWeChat\Auth\WorkWeb;
8
use Pimple\Container;
9
use Pimple\ServiceProviderInterface;
10
11
/**
12
 * Class OAuthServiceProvider.
13
 */
14
class OAuthServiceProvider implements ServiceProviderInterface
15
{
16
    /**
17
     * Registers services on the given container.
18
     *
19
     * This method should only be used to configure services and parameters.
20
     * It should not get services.
21
     *
22
     * @param Container $pimple A container instance
23
     */
24
    public function register(Container $pimple)
25
    {
26
        $pimple['oauth'] = function ($pimple) {
27
            return new App($pimple['access_token']);
28
        };
29
30
        $pimple['auth'] = function ($pimple) {
31
            return new Web($pimple['access_token']);
32
        };
33
34
        $auth_work = function ($pimple) {
35
            return new WorkWeb($pimple['access_token']);
36
        };
37
38
        $pimple['auth_work'] = $auth_work;
39
        $pimple['auth.work'] = $auth_work;
40
    }
41
}
42