Passed
Push — develop ( 176838...c67b25 )
by mingyoung
01:40
created

BaseMessenger   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 34.62 %

Importance

Changes 0
Metric Value
dl 9
loc 26
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A message() 9 9 3

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
/*
4
 * This file is part of the mingyoung/dingtalk.
5
 *
6
 * (c) mingyoung <[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 EasyDingTalk\Kernel;
13
14
use EasyDingTalk\Kernel\Messages\Text;
15
16
/**
17
 * Class BaseMessenger.
18
 *
19
 * @author mingyoung <[email protected]>
20
 */
21
abstract class BaseMessenger
22
{
23
    /**
24
     * @var \EasyDingTalk\Kernel\Messages\Message
25
     */
26
    protected $message;
27
28
    /**
29
     * Message to send.
30
     *
31
     * @param int|string|\EasyDingTalk\Kernel\Messages\Message $message
32
     *
33
     * @return $this
34
     */
35 View Code Duplication
    public function message($message)
0 ignored issues
show
Duplication introduced by
This method 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...
36
    {
37
        if (is_string($message) || is_int($message)) {
38
            $message = new Text($message);
39
        }
40
41
        $this->message = $message;
42
43
        return $this;
44
    }
45
46
    abstract public function send();
47
}
48