Passed
Push — master ( 5dc036...8f7930 )
by Carlos
03:16
created

NewsItem::toJsonArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 9
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 View Code Duplication
    public function toJsonArray()
39
    {
40
        return [
41
            'title' => $this->get('title'),
42
            'description' => $this->get('description'),
43
            'url' => $this->get('url'),
44
            'picurl' => $this->get('image'),
45
        ];
46
    }
47
48 View Code Duplication
    public function toXmlArray()
49
    {
50
        return [
51
            'Title' => $this->get('title'),
52
            'Description' => $this->get('description'),
53
            'Url' => $this->get('url'),
54
            'PicUrl' => $this->get('image'),
55
        ];
56
    }
57
}
58