Completed
Push — master ( 178a08...5c0b6f )
by Oleg
05:22
created

HashStrategy   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A extract() 0 4 1
A hydrate() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DataFlowServer\Authentication\Hydrator\Strategy;
5
6
use SlayerBirden\DataFlowServer\Authentication\PasswordManagerInterface;
7
use SlayerBirden\DataFlowServer\Doctrine\Hydrator\Strategy\ObscuredStrategy;
8
use Zend\Hydrator\Strategy\StrategyInterface;
9
10
class HashStrategy implements StrategyInterface
11
{
12
    /**
13
     * @var PasswordManagerInterface
14
     */
15
    private $passwordManager;
16
17 6
    public function __construct(PasswordManagerInterface $passwordManager)
18
    {
19 6
        $this->passwordManager = $passwordManager;
20 6
    }
21
22
    /**
23
     * @inheritdoc
24
     */
25 2
    public function extract($value)
26
    {
27 2
        return ObscuredStrategy::OBSCURED_STRING;
28
    }
29
30
    /**
31
     * @inheritdoc
32
     */
33 2
    public function hydrate($value)
34
    {
35 2
        return $this->passwordManager->getHash($value);
36
    }
37
}
38