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

Music::toXmlArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 12
ccs 0
cts 12
cp 0
crap 2
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 Music.
16
 *
17
 * @property string $url
18
 * @property string $hq_url
19
 * @property string $title
20
 * @property string $description
21
 * @property string $thumb_media_id
22
 * @property string $format
23
 */
24
class Music extends Message
25
{
26
    /**
27
     * Messages type.
28
     *
29
     * @var string
30
     */
31
    protected $type = 'music';
32
33
    /**
34
     * Properties.
35
     *
36
     * @var array
37
     */
38
    protected $properties = [
39
        'title',
40
        'description',
41
        'url',
42
        'hq_url',
43
        'thumb_media_id',
44
        'format',
45
    ];
46
47
    public function toXmlArray()
48
    {
49
        return [
50
            'Music' => [
51
                'Title' => $this->get('title'),
52
                'Description' => $this->get('description'),
53
                'MusicUrl' => $this->get('url'),
54
                'HQMusicUrl' => $this->get('hq_url'),
55
                'ThumbMediaId' => $this->get('thumb_media_id'),
56
            ],
57
        ];
58
    }
59
}
60