AbstractPlugin   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 59
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getSlackbot() 0 4 1
A setSlackbot() 0 4 1
A getDictionary() 0 8 2
A setDictionary() 0 4 1
1
<?php
2
3
namespace Botonomous\plugin;
4
5
use Botonomous\Dictionary;
6
use Botonomous\Slackbot;
7
8
/**
9
 * Class AbstractPlugin.
10
 */
11
abstract class AbstractPlugin implements PluginInterface
12
{
13
    protected $slackbot;
14
15
    /**
16
     * Dependencies.
17
     */
18
    protected $dictionary;
19
20
    /**
21
     * AbstractPlugin constructor.
22
     *
23
     * @param Slackbot $slackbot
24
     */
25 10
    public function __construct(Slackbot $slackbot)
26
    {
27 10
        $this->setSlackbot($slackbot);
28 10
    }
29
30
    /**
31
     * Return Botonomous.
32
     *
33
     * @return Slackbot
34
     */
35 5
    public function getSlackbot(): Slackbot
36
    {
37 5
        return $this->slackbot;
38
    }
39
40
    /**
41
     * Set Botonomous.
42
     *
43
     * @param Slackbot $slackbot
44
     */
45 10
    public function setSlackbot($slackbot)
46
    {
47 10
        $this->slackbot = $slackbot;
48 10
    }
49
50
    /**
51
     * @return Dictionary
52
     */
53 2
    public function getDictionary(): Dictionary
54
    {
55 2
        if (!isset($this->dictionary)) {
56 2
            $this->setDictionary((new Dictionary()));
57
        }
58
59 2
        return $this->dictionary;
60
    }
61
62
    /**
63
     * @param Dictionary $dictionary
64
     */
65 2
    public function setDictionary(Dictionary $dictionary)
66
    {
67 2
        $this->dictionary = $dictionary;
68 2
    }
69
}
70