Completed
Push — master ( 06c1ce...67d37c )
by Jeroen
06:20
created

onPasswordResettingSuccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Kunstmaan\AdminBundle\EventListener;
4
5
use FOS\UserBundle\Event\FilterUserResponseEvent;
6
use FOS\UserBundle\Model\UserManager;
7
8
/**
9
 * Set password_changed property to 1 after changing the password
10
 */
11
class PasswordResettingListener
12
{
13
    /**
14
     * @var UserManager
15
     */
16
    private $userManager;
17
18
    /**
19
     * @param UserManager $userManager
20
     */
21 1
    public function __construct(UserManager $userManager)
22
    {
23 1
        $this->userManager = $userManager;
24 1
    }
25
26
    /**
27
     * @param FilterUserResponseEvent $event
28
     */
29 1
    public function onPasswordResettingSuccess(FilterUserResponseEvent $event)
30
    {
31 1
        $user = $event->getUser();
32 1
        $user->setPasswordChanged(true);
0 ignored issues
show
Bug introduced by
The method setPasswordChanged() does not exist on FOS\UserBundle\Model\UserInterface. Did you maybe mean setPassword()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
33 1
        $this->userManager->updateUser($user);
34 1
    }
35
}
36