Test Setup Failed
Push — develop ( dc2cdb...883a72 )
by Stone
04:31
created

UserValidatedSubscriber::sendFlash()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\EventSubscriber\User;
4
5
use App\Event\User\UserValidatedEvent;
6
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
7
8
class UserValidatedSubscriber extends UserSubscriber implements EventSubscriberInterface
9
{
10
11
12
    public function validateUser(UserValidatedEvent $event)
13
    {
14
        $user = $event->getEntity();
15
        $user->setVerified(true);
0 ignored issues
show
Bug introduced by
The method setVerified() does not exist on App\Entity\Trick. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

15
        $user->/** @scrutinizer ignore-call */ 
16
               setVerified(true);

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...
16
        $this->persist($event);
17
    }
18
19
    public function sendFlash()
20
    {
21
        $this->addFlash('success', 'Account is verified');
22
    }
23
24
25
    /**
26
     * @return array The event names to listen to
27
     */
28
    public static function getSubscribedEvents()
29
    {
30
        return [
31
            UserValidatedEvent::NAME => [
32
                ['validateUser', 40],
33
                ['flush', 20],
34
                ['sendFlash', 0],
35
            ]
36
        ];
37
    }
38
}