HashStrategy::hydrate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
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
final class HashStrategy implements StrategyInterface
11
{
12
    /**
13
     * @var PasswordManagerInterface
14
     */
15
    private $passwordManager;
16
17 14
    public function __construct(PasswordManagerInterface $passwordManager)
18
    {
19 14
        $this->passwordManager = $passwordManager;
20 14
    }
21
22
    /**
23
     * @inheritdoc
24
     */
25 4
    public function extract($value)
26
    {
27 4
        return ObscuredStrategy::OBSCURED_STRING;
28
    }
29
30
    /**
31
     * @inheritdoc
32
     */
33 4
    public function hydrate($value)
34
    {
35 4
        return $this->passwordManager->getHash($value);
36
    }
37
}
38