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

NewsItem::toXmlArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 9
ccs 0
cts 9
cp 0
crap 2
rs 9.6666
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 NewsItem.
16
 */
17
class NewsItem extends Message
18
{
19
    /**
20
     * Messages type.
21
     *
22
     * @var string
23
     */
24
    protected $type = 'news';
25
26
    /**
27
     * Properties.
28
     *
29
     * @var array
30
     */
31
    protected $properties = [
32
        'title',
33
        'description',
34
        'url',
35
        'image',
36
    ];
37
38
    /**
39
     * Aliases of attribute.
40
     *
41
     * @var array
42
     */
43
    protected $jsonAliases = [
44
        'pic_url' => 'image',
45
    ];
46
47
    public function toXmlArray()
48
    {
49
        return [
50
            'Title' => $this->get('title'),
51
            'Description' => $this->get('description'),
52
            'Url' => $this->get('url'),
53
            'PicUrl' => $this->get('image'),
54
        ];
55
    }
56
}
57