Completed
Push — master ( f9521c...a16a3a )
by Roni
02:17
created

AuthenticationFailedCommand::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the XiideaEasyAuditBundle package.
5
 *
6
 * (c) Xiidea <http://www.xiidea.net>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Xiidea\EasyAuditBundle\Resolver\UserEventCommand;
13
14
15
use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent;
16
17
class AuthenticationFailedCommand extends ResolverCommand
18
{
19
    /**
20
     * @param AuthenticationFailureEvent $event
21
     * @return null|array
22
     */
23
    public function resolve($event)
24
    {
25
        if ($event instanceof AuthenticationFailureEvent) {
26
            return $this->getEventDetails($event);
27
        }
28
29
        return null;
30
    }
31
32
    /**
33
     * @param AuthenticationFailureEvent $event
34
     * @return array
35
     */
36
    private function getEventDetails(AuthenticationFailureEvent $event)
37
    {
38
        return $this->getEventDetailsArray(
39
            $event->getAuthenticationToken()->getUser()
40
        );
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getType()
47
    {
48
        return "Authentication Failed";
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getTemplate()
55
    {
56
        return 'Bad credentials Username: %s';
57
    }
58
}
59