StackName   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 12
c 1
b 0
f 0
dl 0
loc 36
ccs 17
cts 17
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A check() 0 3 1
A updateName() 0 3 1
A add() 0 3 1
A reset() 0 3 1
A get() 0 3 1
1
<?php
2
3
namespace kalanis\kw_notify\Extend;
4
5
6
use kalanis\kw_notify\Interfaces\INotify;
7
8
9
/**
10
 * Class StackName
11
 * @package kalanis\kw_notify\Extend
12
 * Change key name in notifications
13
 */
14
class StackName implements INotify
15
{
16
    protected INotify $notify;
17
    protected string $prefix = '';
18
    protected string $suffix = '';
19
20 1
    public function __construct(INotify $storage, string $prefix = '', string $suffix = '')
21
    {
22 1
        $this->notify = $storage;
23 1
        $this->prefix = $prefix;
24 1
        $this->suffix = $suffix;
25 1
    }
26
27 1
    public function add(string $stackName, string $message): void
28
    {
29 1
        $this->notify->add($this->updateName($stackName), $message);
30 1
    }
31
32 1
    public function check(string $stackName): bool
33
    {
34 1
        return $this->notify->check($this->updateName($stackName));
35
    }
36
37 1
    public function get(string $stackName): array
38
    {
39 1
        return $this->notify->get($this->updateName($stackName));
40
    }
41
42 1
    public function reset(string $stackName): void
43
    {
44 1
        $this->notify->reset($this->updateName($stackName));
45 1
    }
46
47 1
    protected function updateName(string $stackName): string
48
    {
49 1
        return $this->prefix . $stackName . $this->suffix;
50
    }
51
}
52