UserServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
B register() 0 35 1
1
<?php
2
3
namespace YEntWeChat\Foundation\ServiceProviders;
4
5
use YEntWeChat\User\Batch;
6
use YEntWeChat\User\Department;
7
use YEntWeChat\User\Tag;
8
use YEntWeChat\User\User;
9
use Pimple\Container;
10
use Pimple\ServiceProviderInterface;
11
12
/**
13
 * Class UserServiceProvider.
14
 */
15
class UserServiceProvider implements ServiceProviderInterface
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['user'] = function ($pimple) {
28
            return new User($pimple['access_token']);
29
        };
30
31
        $department = function ($pimple) {
32
            return new Department($pimple['access_token']);
33
        };
34
35
        $tag = function ($pimple) {
36
            return new Tag($pimple['access_token']);
37
        };
38
39
        $batch = function ($pimple) {
40
            return new Batch($pimple['access_token']);
41
        };
42
43
        $pimple['department'] = $department;
44
        $pimple['party'] = $department;
45
46
        $pimple['user_party'] = $department;
47
        $pimple['user.party'] = $department;
48
49
        $pimple['user_department'] = $department;
50
        $pimple['user.department'] = $department;
51
52
        $pimple['tag'] = $tag;
53
54
        $pimple['user_tag'] = $tag;
55
        $pimple['user.tag'] = $tag;
56
57
        $pimple['user_batch'] = $batch;
58
        $pimple['user.batch'] = $batch;
59
    }
60
}
61