Completed
Push — master ( 1b605f...95b7c3 )
by Dan
06:00
created

HelpPlugin::yabotHelp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
namespace Nopolabs\Yabot\Plugin;
3
4
use Nopolabs\Yabot\Message\Message;
5
use Nopolabs\Yabot\Yabot;
6
use Psr\Log\LoggerInterface;
7
8 View Code Duplication
class HelpPlugin implements PluginInterface
1 ignored issue
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...
9
{
10
    use PluginTrait;
11
12
    private $yabot;
13
14
    public function __construct(LoggerInterface $logger, Yabot $yabot)
15
    {
16
        $this->setLog($logger);
17
        $this->yabot = $yabot;
18
19
        $this->setConfig([
20
            'help' => '<prefix> help',
21
            'prefix' => Yabot::AUTHED_USER,
22
            'matchers' => ['yabotHelp' => "/^help\\b/"],
23
        ]);
24
    }
25
26
    public function yabotHelp(Message $msg, array $matches)
1 ignored issue
show
Unused Code introduced by
The parameter $matches is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
27
    {
28
        $msg->reply($this->yabot->getHelp());
29
        $msg->setHandled(true);
30
    }
31
}
32