MpNews   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 48
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 48
loc 48
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A thumb() 6 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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