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

HashStrategy::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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