Completed
Pull Request — master (#84)
by Tobias
07:00
created

PluginJournal::getPluginName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace Http\HttplugBundle\Collector;
4
5
/**
6
 * A object that remembers what plugins are configured for which clients.
7
 *
8
 * @author Tobias Nyholm <[email protected]>
9
 */
10
class PluginJournal
11
{
12
    /**
13
     * @var array ['clientName'=>['index' => 'PluginName']
14
     */
15
    private $data;
16
17
    /**
18
     * @return array
19
     */
20
    public function getPlugins($clientName)
21
    {
22
        return $this->data[$clientName];
23
    }
24
25
    /**
26
     * @return string|null
27
     */
28
    public function getPluginName($clientName, $idx)
29
    {
30
        if (isset($this->data[$clientName][$idx])) {
31
            return $this->data[$clientName][$idx];
32
        }
33
34
        return;
35
    }
36
37
    /**
38
     * @param string $clientName
39
     * @param array  $plugins
40
     *
41
     * @return $this
42
     */
43
    public function setPlugins($clientName, array $plugins)
44
    {
45
        $this->data[$clientName] = $plugins;
46
47
        return $this;
48
    }
49
}
50