U2fRegistrationSuccessEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 1
b 0
f 0
dl 0
loc 43
ccs 10
cts 10
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 3 1
A getUser() 0 3 1
A getKey() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the U2F Security bundle.
5
 *
6
 * (c) Michael Barbey <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Mbarbey\U2fSecurityBundle\Event\Registration;
13
14
use Symfony\Component\EventDispatcher\Event;
15
use Mbarbey\U2fSecurityBundle\Model\User\U2fUserInterface;
16
use Mbarbey\U2fSecurityBundle\Model\Key\U2fKeyInterface;
17
18
/**
19
 * U2F registration success event
20
 *
21
 * An event dispatched when a user successfully register an U2F security key.
22
 *
23
 * This event contain the user and the newly registered key.
24
 *
25
 * @author Michael Barbey <[email protected]>
26
 */
27
class U2fRegistrationSuccessEvent extends Event
28
{
29
    private $user;
30
    private $key;
31
32
    /**
33
     * Return the name of the event to use when dispatching this event.
34
     *
35
     * @return string
36
     */
37 1
    public static function getName()
38
    {
39 1
        return 'u2f.registration.success';
40
    }
41
42
    /**
43
     * @param U2fUserInterface $user    The user who successfully registered a key
44
     * @param U2fKeyInterface $key      The securtiy key which was registered
45
     */
46 3
    public function __construct(U2fUserInterface $user, U2fKeyInterface $key)
47
    {
48 3
        $this->user = $user;
49 3
        $this->key = $key;
50 3
    }
51
52
    /**
53
     * Return the user who successfully registered a new security key
54
     *
55
     * @return U2fUserInterface
56
     */
57 1
    public function getUser()
58
    {
59 1
        return $this->user;
60
    }
61
62
    /**
63
     * Return the newly registered securtiy key
64
     *
65
     * @return U2fKeyInterface
66
     */
67 1
    public function getKey()
68
    {
69 1
        return $this->key;
70
    }
71
}
72