Completed
Pull Request — master (#292)
by Carlos
05:19 queued 02:03
created

Video   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 49
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A media() 0 6 1
A thumb() 0 6 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
/**
13
 * Video.php.
14
 *
15
 * @author    overtrue <[email protected]>
16
 * @copyright 2015 overtrue <[email protected]>
17
 *
18
 * @link      https://github.com/overtrue
19
 * @link      http://overtrue.me
20
 */
21
namespace EasyWeChat\Message;
22
23
/**
24
 * Class Video.
25
 *
26
 * @property string $video
27
 * @property string $title
28
 * @property string $media_id
29
 * @property string $description
30
 * @property string $thumb_media_id
31
 */
32
class Video extends AbstractMessage
33
{
34
    /**
35
     * Message type.
36
     *
37
     * @var string
38
     */
39
    protected $type = 'video';
40
41
    /**
42
     * Properties.
43
     *
44
     * @var array
45
     */
46
    protected $properties = [
47
                             'title',
48
                             'description',
49
                             'media_id',
50
                             'thumb_media_id',
51
                            ];
52
53
    /**
54
     * 设置视频消息.
55
     *
56
     * @param string $mediaId
57
     *
58
     * @return Video
59
     */
60 1
    public function media($mediaId)
61
    {
62 1
        $this->setAttribute('media_id', $mediaId);
63
64 1
        return $this;
65
    }
66
67
    /**
68
     * 设置视频封面.
69
     *
70
     * @param string $mediaId
71
     *
72
     * @return Video
73
     */
74 1
    public function thumb($mediaId)
75
    {
76 1
        $this->setAttribute('thumb_media_id', $mediaId);
77
78 1
        return $this;
79
    }
80
}
81