Completed
Push — master ( a679b5...bc4430 )
by Carlos
03:34
created

CardServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 9 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
/**
13
 * JsServiceProvider.php.
14
 *
15
 * This file is part of the wechat.
16
 *
17
 * (c) overtrue <[email protected]>
18
 *
19
 * This source file is subject to the MIT license that is bundled
20
 * with this source code in the file LICENSE.
21
 */
22
namespace EasyWeChat\Foundation\ServiceProviders;
23
24
use EasyWeChat\Card\Card;
25
use Pimple\Container;
26
use Pimple\ServiceProviderInterface;
27
28
/**
29
 * Class JsServiceProvider.
30
 */
31 View Code Duplication
class CardServiceProvider implements ServiceProviderInterface
32
{
33
    /**
34
     * Registers services on the given container.
35
     *
36
     * This method should only be used to configure services and parameters.
37
     * It should not get services.
38
     *
39
     * @param Container $pimple A container instance
40
     */
41
    public function register(Container $pimple)
42
    {
43
        $pimple['card'] = function ($pimple) {
44
            $card = new Card($pimple['access_token']);
45
            $card->setCache($pimple['cache']);
46
47
            return $card;
48
        };
49
    }
50
}
51