Completed
Pull Request — master (#292)
by Carlos
05:19 queued 02:03
created

Merchant::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
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
 * Merchant.php.
14
 *
15
 * @author    overtrue <[email protected]>
16
 * @copyright 2015 overtrue <[email protected]>
17
 *
18
 * @link      https://github.com/overtrue
19
 * @link      http://overtrue.me
20
 */
21
namespace EasyWeChat\Payment;
22
23
use EasyWeChat\Support\Attribute;
24
25
/**
26
 * Class Merchant.
27
 *
28
 * @property string $app_id
29
 * @property string $merchant_id
30
 * @property string $key
31
 * @property string $sub_app_id
32
 * @property string $sub_merchant_id
33
 * @property string $ssl_cert_path
34
 * @property string $ssl_key_path
35
 * @property string $fee_type
36
 * @property string $device_info
37
 */
38
class Merchant extends Attribute
39
{
40
    /**
41
     * @var array
42
     */
43
    protected $attributes = [
44
        'app_id',
45
        'merchant_id',
46
        'key',
47
        'sub_app_id',
48
        'sub_merchant_id',
49
        'ssl_cert_path',
50
        'ssl_key_path',
51
        'fee_type',
52
        'device_info',
53
    ];
54
55
    /**
56
     * Aliases of attributes.
57
     *
58
     * @var array
59
     */
60
    protected $aliases = [
61
        'app_id' => 'appid',
62
        'key' => 'mch_key',
63
        'merchant_id' => 'mch_id',
64
        'cert_path' => 'sslcert_path',
65
        'key_path' => 'sslkey_path',
66
    ];
67
68
    /**
69
     * Constructor.
70
     *
71
     * @param array $attributes
72
     */
73 27
    public function __construct(array $attributes)
74
    {
75 27
        parent::__construct($attributes);
76
77 27
        $this->with('fee_type', 'CNY');
78 27
    }
79
}
80