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

Video::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 4
cp 0
crap 2
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 Video.
16
 *
17
 * @property string $video
18
 * @property string $title
19
 * @property string $media_id
20
 * @property string $description
21
 * @property string $thumb_media_id
22
 */
23
class Video extends Media
24
{
25
    /**
26
     * Messages type.
27
     *
28
     * @var string
29
     */
30
    protected $type = 'video';
31
32
    /**
33
     * Properties.
34
     *
35
     * @var array
36
     */
37
    protected $properties = [
38
        'title',
39
        'description',
40
        'media_id',
41
        'thumb_media_id',
42
    ];
43
44
    /**
45
     * Video constructor.
46
     *
47
     * @param string $mediaId
48
     * @param array  $attributes
49
     */
50
    public function __construct(string $mediaId, array $attributes = [])
51
    {
52
        parent::__construct($mediaId, 'video', $attributes);
53
    }
54
55
    public function toXmlArray()
56
    {
57
        return [
58
            'Video' => [
59
                'MediaId' => $this->get('media_id'),
60
                'Title' => $this->get('title'),
61
                'Description' => $this->get('description'),
62
            ],
63
        ];
64
    }
65
}
66