MaterialServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

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