Video::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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 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 1
    public function __construct(string $mediaId, array $attributes = [])
51
    {
52 1
        parent::__construct($mediaId, 'video', $attributes);
53 1
    }
54
55 1
    public function toXmlArray()
56
    {
57
        return [
58
            'Video' => [
59 1
                'MediaId' => $this->get('media_id'),
60 1
                'Title' => $this->get('title'),
61 1
                'Description' => $this->get('description'),
62
            ],
63
        ];
64
    }
65
}
66