PoolDecorator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 31
ccs 9
cts 9
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A decorate() 0 8 1
1
<?php
2
namespace Jsq\CacheEncryption\Password;
3
4
use Jsq\CacheEncryption\PoolDecorator as BasePoolDecorator;
5
use Psr\Cache\CacheItemInterface;
6
use Psr\Cache\CacheItemPoolInterface;
7
8
class PoolDecorator extends BasePoolDecorator
9
{
10
    /** @var string */
11
    private $password;
12
    /** @var string */
13
    private $cipher;
14
15
    /**
16
     * @param CacheItemPoolInterface $decorated
17
     * @param string $password
18
     * @param string $cipher
19
     */
20 441
    public function __construct(
21
        CacheItemPoolInterface $decorated,
22
        $password,
23
        $cipher = 'aes-256-cbc'
24
    ) {
25 441
        parent::__construct($decorated);
26 441
        $this->password = $password;
27 441
        $this->cipher = $cipher;
28 441
    }
29
30 135
    protected function decorate(CacheItemInterface $item)
31
    {
32 135
        return new ItemDecorator(
33
            $item,
34 135
            $this->password,
35 135
            $this->cipher
36
        );
37
    }
38
}
39