1 | <?php |
||
20 | class RollbarListener |
||
21 | { |
||
22 | /** |
||
23 | * @var Notifier |
||
24 | */ |
||
25 | protected $notifier; |
||
26 | |||
27 | /** |
||
28 | * @var TokenStorageInterface |
||
29 | */ |
||
30 | protected $tokenStorage; |
||
31 | |||
32 | /** |
||
33 | * @var AuthorizationCheckerInterface |
||
34 | */ |
||
35 | protected $authorizationChecker; |
||
36 | |||
37 | /** |
||
38 | * @var \Exception |
||
39 | */ |
||
40 | protected $exception; |
||
41 | |||
42 | /** |
||
43 | * @var ErrorHandler |
||
44 | */ |
||
45 | private $errorHandler; |
||
46 | /** |
||
47 | * @var UserHelper |
||
48 | */ |
||
49 | private $userHelper; |
||
50 | |||
51 | /** |
||
52 | * Init. |
||
53 | * |
||
54 | * @param Notifier $notifier |
||
55 | * @param ErrorHandler $errorHandler |
||
56 | * @param TokenStorageInterface $tokenStorage |
||
57 | * @param AuthorizationCheckerInterface $authorizationChecker |
||
58 | * @param UserHelper $userHelper |
||
59 | */ |
||
60 | public function __construct( |
||
82 | |||
83 | /** |
||
84 | * Register error handler. |
||
85 | * |
||
86 | * @param GetResponseEvent $event |
||
87 | */ |
||
88 | public function onKernelRequest(GetResponseEvent $event) |
||
93 | |||
94 | /** |
||
95 | * Save exception. |
||
96 | * |
||
97 | * @param GetResponseForExceptionEvent $event |
||
98 | */ |
||
99 | public function onKernelException(GetResponseForExceptionEvent $event) |
||
108 | |||
109 | /** |
||
110 | * @param ConsoleCommandEvent $event |
||
111 | */ |
||
112 | public function onConsoleCommand(ConsoleCommandEvent $event) |
||
116 | |||
117 | /** |
||
118 | * @param ConsoleExceptionEvent $event |
||
119 | */ |
||
120 | public function onConsoleException(ConsoleExceptionEvent $event) |
||
124 | |||
125 | /** |
||
126 | * Wrap exception with additional info. |
||
127 | * |
||
128 | * @param FilterResponseEvent $event |
||
129 | */ |
||
130 | public function onKernelResponse(FilterResponseEvent $event) |
||
137 | |||
138 | /** |
||
139 | * Get current user info. |
||
140 | * |
||
141 | * @return null|array |
||
142 | */ |
||
143 | public function getUserData() |
||
144 | { |
||
145 | if (!$this->tokenStorage->getToken() |
||
146 | || !$this->authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED') |
||
147 | ) { |
||
148 | return null; |
||
149 | } |
||
150 | |||
151 | $user = $this->tokenStorage->getToken()->getUser(); |
||
152 | |||
153 | if (!$user) { |
||
154 | return null; |
||
155 | } |
||
156 | |||
157 | return $this->userHelper->buildUserData($user); |
||
158 | } |
||
159 | |||
160 | /** |
||
161 | * @return \Exception |
||
162 | */ |
||
163 | public function getException() |
||
167 | |||
168 | /** |
||
169 | * @param \Exception|null $exception |
||
170 | */ |
||
171 | public function setException($exception) |
||
175 | } |
||
176 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.