Completed
Push — master ( 6e6ef1...674ce8 )
by Chad
02:04
created

LoadUserEvent::getDomain()   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
 * This file is part of the LdapToolsBundle package.
4
 *
5
 * (c) Chad Sikorra <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LdapTools\Bundle\LdapToolsBundle\Event;
12
13
use LdapTools\Bundle\LdapToolsBundle\Security\User\LdapUser;
14
use Symfony\Component\EventDispatcher\Event;
15
use Symfony\Component\Security\Core\User\UserInterface;
16
17
/**
18
 * Represents a User load event.
19
 *
20
 * @author Chad Sikorra <[email protected]>
21
 */
22
class LoadUserEvent extends Event
23
{
24
    /**
25
     * The event name that happens before a user is loaded from the user provider.
26
     */
27
    const BEFORE = 'ldap_tools_bundle.load_user.before';
28
29
    /**
30
     * The event name that happens after a user is loaded from the user provider.
31
     */
32
    const AFTER = 'ldap_tools_bundle.load_user.after';
33
34
    /**
35
     * @var string
36
     */
37
    protected $username;
38
39
    /**
40
     * @var string
41
     */
42
    protected $domain;
43
44
    /**
45
     * @var UserInterface|LdapUser|null
46
     */
47
    protected $user;
48
49
    /**
50
     * @param $username
51
     * @param $domain
52
     * @param UserInterface $user
53
     */
54
    public function __construct($username, $domain, UserInterface $user = null)
55
    {
56
        $this->username = $username;
57
        $this->domain = $domain;
58
        $this->user = $user;
59
    }
60
61
    /**
62
     * @return string
63
     */
64
    public function getUsername()
65
    {
66
        return $this->username;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getDomain()
73
    {
74
        return $this->domain;
75
    }
76
77
    /**
78
     * This is only available on an AFTER load event. Otherwise it will be null.
79
     *
80
     * @return LdapUser|null|UserInterface
81
     */
82
    public function getUser()
83
    {
84
        return $this->user;
85
    }
86
}
87