HelpPlugin   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A yabotHelp() 0 5 1
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
class HelpPlugin implements PluginInterface
9
{
10
    use PluginTrait;
11
12
    private $yabot;
13
14
    public function __construct(Yabot $yabot, LoggerInterface $logger = null)
15
    {
16
        $this->setLog($logger);
17
        $this->yabot = $yabot;
18
19
        $this->setConfig([
20
            'help' => '<prefix> help',
21
            'prefix' => PluginManager::AUTHED_USER_PREFIX,
22
            'matchers' => ['yabotHelp' => "/^help\\b/"],
23
        ]);
24
    }
25
26
    public function yabotHelp(Message $msg)
27
    {
28
        $msg->reply($this->yabot->getHelp());
29
        $msg->setHandled(true);
30
    }
31
}
32