MpNews::thumb()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace EntWeChat\Message;
4
5
/**
6
 * Class MpNews.
7
 *
8
 * @property string $title
9
 * @property string $thumb_media_id
10
 * @property string $author
11
 * @property string $source_url
12
 * @property string $content
13
 * @property string $digest
14
 * @property string $show_cover
15
 */
16 View Code Duplication
class MpNews extends AbstractMessage
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    /**
19
     * Message type.
20
     *
21
     * @var string
22
     */
23
    protected $type = 'mpnews';
24
25
    /**
26
     * Properties.
27
     *
28
     * @var array
29
     */
30
    protected $properties = [
31
        'title',
32
        'thumb_media_id',
33
        'author',
34
        'source_url',
35
        'content',
36
        'digest',
37
        'show_cover',
38
    ];
39
40
    /**
41
     * Aliases of attribute.
42
     *
43
     * @var array
44
     */
45
    protected $aliases = [
46
        'source_url' => 'content_source_url',
47
        'show_cover' => 'show_cover_pic',
48
    ];
49
50
    /**
51
     * 设置音乐封面.
52
     *
53
     * @param string $mediaId
54
     *
55
     * @return $this
56
     */
57
    public function thumb($mediaId)
58
    {
59
        $this->setAttribute('thumb_media_id', $mediaId);
60
61
        return $this;
62
    }
63
}
64