1 | <?php |
||
20 | class UserAwareComponent |
||
21 | { |
||
22 | /** |
||
23 | * @var TokenStorageInterface |
||
24 | */ |
||
25 | private $tokenStorage; |
||
26 | |||
27 | /** |
||
28 | * @var AuthorizationCheckerInterface |
||
29 | */ |
||
30 | private $authChecker; |
||
31 | |||
32 | /** |
||
33 | * @var RequestStack |
||
34 | */ |
||
35 | private $requestStack; |
||
36 | |||
37 | /** |
||
38 | * @param TokenStorageInterface $tokenStorage |
||
39 | */ |
||
40 | public function setTokenStorage($tokenStorage) |
||
44 | |||
45 | |||
46 | /** |
||
47 | * Get a user from the Security Context |
||
48 | * |
||
49 | * @return mixed |
||
50 | * @throws \LogicException If SecurityBundle is not available |
||
51 | */ |
||
52 | public function getUser() |
||
65 | |||
66 | /** |
||
67 | * @param AuthorizationCheckerInterface $authChecker |
||
68 | */ |
||
69 | public function setAuthChecker($authChecker) |
||
73 | |||
74 | /** |
||
75 | * @param RequestStack $requestStack |
||
76 | */ |
||
77 | public function setRequestStack($requestStack) |
||
81 | |||
82 | /** |
||
83 | * @return mixed |
||
84 | */ |
||
85 | final protected function getImpersonatingUser() |
||
97 | |||
98 | /** |
||
99 | * @return string |
||
100 | */ |
||
101 | public function getUsername() |
||
111 | |||
112 | /** |
||
113 | * @return string |
||
114 | */ |
||
115 | protected function getAnonymousUserName() |
||
125 | |||
126 | /** |
||
127 | * @param TokenInterface $token |
||
128 | * @param null $user |
||
129 | * @return mixed |
||
130 | */ |
||
131 | protected function getImpersonatingUserFromRole($token, $user = null) |
||
142 | |||
143 | protected function getRequest() |
||
151 | } |
||
152 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: