Total Complexity | 4 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 88.89% |
Changes | 0 |
1 | <?php |
||
14 | final class UserProcessor implements ProcessorInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var UserPasswordEncoderInterface |
||
18 | */ |
||
19 | private $encoder; |
||
20 | |||
21 | /** |
||
22 | * @param UserPasswordEncoderInterface $encoder |
||
23 | */ |
||
24 | 2 | public function __construct(UserPasswordEncoderInterface $encoder) |
|
25 | { |
||
26 | 2 | $this->encoder = $encoder; |
|
27 | 2 | } |
|
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | 2 | public function preProcess(string $fixtureId, $object): void |
|
33 | { |
||
34 | /** @var User $object * */ |
||
35 | 2 | if ($object instanceof User === false) { |
|
36 | 1 | return; |
|
37 | } |
||
38 | |||
39 | 1 | $object->setPassword($this->encoder->encodePassword($object, $object->getPassword())); |
|
40 | 1 | } |
|
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public function postProcess(string $fixtureId, $object): void |
||
47 | // nothing to do |
||
48 | } |
||
49 | } |
||
50 |