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

UserProcessor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 34
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A preProcess() 0 8 2
A postProcess() 0 3 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