Passed
Push — master ( a2a2c3...5dc036 )
by Carlos
03:01
created

Transfer::toXmlArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 8
ccs 0
cts 8
cp 0
crap 6
rs 9.4285
c 0
b 0
f 0
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
namespace EasyWeChat\Kernel\Messages;
13
14
/**
15
 * Class Transfer.
16
 *
17
 * @property string $to
18
 * @property string $account
19
 */
20
class Transfer extends Message
21
{
22
    /**
23
     * Messages type.
24
     *
25
     * @var string
26
     */
27
    protected $type = 'transfer_customer_service';
28
29
    /**
30
     * Properties.
31
     *
32
     * @var array
33
     */
34
    protected $properties = [
35
        'account',
36
    ];
37
38
    /**
39
     * Transfer constructor.
40
     *
41
     * @param string|null $account
42
     */
43
    public function __construct(string $account = null)
44
    {
45
        if (!is_null($account)) {
46
            $this->account = $account;
47
        }
48
    }
49
50
    public function toXmlArray()
51
    {
52
        return empty($this->get('account')) ? [] : [
53
            'TransInfo' => [
54
                'KfAccount' => $this->get('account'),
55
            ],
56
        ];
57
    }
58
}
59