Completed
Push — 1.4-password-hashing ( c4872d )
by Kamil
11:17
created

UserWithEncoderFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Sylius\Bundle\UserBundle\Factory;
6
7
use Sylius\Component\Resource\Factory\FactoryInterface;
8
use Sylius\Component\User\Model\UserInterface;
9
10
final class UserWithEncoderFactory implements FactoryInterface
11
{
12
    /** @var FactoryInterface */
13
    private $decoratedUserFactory;
14
15
    /** @var string */
16
    private $encoderName;
17
18
    public function __construct(FactoryInterface $decoratedUserFactory, string $encoderName)
19
    {
20
        $this->decoratedUserFactory = $decoratedUserFactory;
21
        $this->encoderName = $encoderName;
22
    }
23
24
    public function createNew(): UserInterface
25
    {
26
        /** @var UserInterface $user */
27
        $user = $this->decoratedUserFactory->createNew();
28
29
        $user->setEncoderName($this->encoderName);
30
31
        return $user;
32
    }
33
}
34