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

NewsItem   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 40
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A toXmlArray() 0 9 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
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