Completed
Push — master ( 89c941...5b3aee )
by
unknown
10s
created

UserProcessor::preProcess()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Smart\AuthenticationBundle\DataFixtures\Processor;
4
5
use Nelmio\Alice\ProcessorInterface;
6
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
7
use Symfony\Component\Security\Core\User\UserInterface;
8
9
/**
10
 * @author Nicolas Bastien <[email protected]>
11
 */
12
class UserProcessor implements ProcessorInterface
13
{
14
    /**
15
     * @var UserPasswordEncoderInterface
16
     */
17
    private $encoder;
18
19
    /**
20
     * @param UserPasswordEncoderInterface $encoder
21
     */
22
    public function __construct(UserPasswordEncoderInterface $encoder)
23
    {
24
        $this->encoder = $encoder;
25
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30
    public function preProcess($object)
31
    {
32
        if (!$object instanceof UserInterface) {
33
            return;
34
        }
35
36
        $object->setPassword($this->encoder->encodePassword($object, $object->getPlainPassword()));
0 ignored issues
show
Bug introduced by
The method getPlainPassword() does not seem to exist on object<Symfony\Component...ore\User\UserInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method setPassword() does not seem to exist on object<Symfony\Component...ore\User\UserInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
    }
38
39
    /**
40
     * @inheritdoc
41
     */
42
    public function postProcess($object)
43
    {
44
    }
45
}
46