Conditions | 8 |
Paths | 5 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 12 |
Ratio | 50 % |
Changes | 0 |
1 | <?php |
||
34 | public function matches(Message $message) : bool |
||
35 | { |
||
36 | if ($message->isHandled()) { |
||
37 | $this->debug('message already handled'); |
||
38 | return false; |
||
39 | } |
||
40 | |||
41 | View Code Duplication | if ($this->isBot !== null && $this->isBot !== $message->isBot()) { |
|
|
|||
42 | $this->debug('isBot match failed'); |
||
43 | return false; |
||
44 | } |
||
45 | |||
46 | View Code Duplication | if ($this->channels && !in_array($message->getChannelName(), $this->channels)) { |
|
47 | $this->debug('channels match failed '.json_encode($this->channels)); |
||
48 | return false; |
||
49 | } |
||
50 | |||
51 | View Code Duplication | if ($this->users && !in_array($message->getUsername(), $this->users)) { |
|
52 | $this->debug('users match failed '.json_encode($this->users)); |
||
53 | return false; |
||
54 | } |
||
55 | |||
56 | return true; |
||
57 | } |
||
58 | |||
64 |
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.