Completed
Push — master ( 73ed3f...e38e9f )
by Carlos
02:46
created

AbstractComponent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
ccs 0
cts 6
cp 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
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
 * AbstractComponent.php.
14
 *
15
 * Part of Overtrue\WeChat.
16
 *
17
 * For the full copyright and license information, please view the LICENSE
18
 * file that was distributed with this source code.
19
 *
20
 * @author    mingyoung <[email protected]>
21
 * @copyright 2016
22
 *
23
 * @see      https://github.com/overtrue
24
 * @see      http://overtrue.me
25
 */
26
27
namespace EasyWeChat\OpenPlatform\Components;
28
29
use EasyWeChat\Core\AbstractAPI;
30
use Symfony\Component\HttpFoundation\Request;
31
32
abstract class AbstractComponent extends AbstractAPI
33
{
34
    /**
35
     * Config.
36
     *
37
     * @var array
38
     */
39
    protected $config;
40
41
    /**
42
     * Request.
43
     *
44
     * @var Symfony\Component\HttpFoundation\Request
45
     */
46
    protected $request;
47
48
    /**
49
     * AbstractComponent constructor.
50
     *
51
     * @param \EasyWeChat\Core\AccessToken $accessToken
52
     * @param array                        $config
53
     * @param $request
54
     */
55
    public function __construct($accessToken, array $config, $request = null)
56
    {
57
        parent::__construct($accessToken);
58
        $this->config = $config;
59
        $this->request = $request ?: Request::createFromGlobals();
60
    }
61
}
62