Completed
Pull Request — master (#176)
by ru cheng
02:33
created

MpVideo   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 39
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A media() 0 6 1
A toStaff() 0 8 1
1
<?php
2
/**
3
 * MpVideo.php
4
 *
5
 * Part of Overtrue\Wechat.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    overtrue <[email protected]>
11
 * @copyright 2015 overtrue <[email protected]>
12
 * @link      https://github.com/overtrue
13
 * @link      http://overtrue.me
14
 */
15
16
namespace Overtrue\Wechat\Messages;
17
18
/**
19
 * 群发视频消息
20
 *
21
 * @property string $media_id
22
 */
23
class MpVideo extends BaseMessage
24
{
25
    /**
26
     * 属性
27
     *
28
     * @var array
29
     */
30
    protected $properties = array(
31
        'media_id',
32
    );
33
34
    /**
35
     * 设置视频消息
36
     *
37
     * @param string $mediaId
38
     *
39
     * @return Video
40
     */
41
    public function media($mediaId)
42
    {
43
        $this->setAttribute('media_id', $mediaId);
44
45
        return $this;
46
    }
47
48
    /**
49
     * 生成主动消息数组
50
     *
51
     * @return array
52
     */
53
    public function toStaff()
54
    {
55
        return array(
56
            'mpvideo' => array(
57
                'media_id'       => $this->media_id,
58
            ),
59
        );
60
    }
61
}
62