Total Complexity | 8 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class StudentSubscriber implements EventSubscriberInterface |
||
15 | { |
||
16 | |||
17 | |||
18 | public function __construct(ContainerInterface $container) |
||
|
|||
19 | { |
||
20 | |||
21 | } |
||
22 | |||
23 | public function onKernelController(FilterControllerEvent $event) |
||
24 | { |
||
25 | $controller = $event->getController(); |
||
26 | |||
27 | /* |
||
28 | * $controller passed can be either a class or a Closure. |
||
29 | * This is not usual in Symfony but it may happen. |
||
30 | * If it is a class, it comes in array format |
||
31 | */ |
||
32 | if (!is_array($controller)) { |
||
33 | return; |
||
34 | } |
||
35 | |||
36 | if ($controller[0] instanceof AuthenticatedInterface) { |
||
37 | if (isset($_SESSION['phpCAS']['user'])) { |
||
38 | throw new AccessDeniedHttpException('Access forbidden.'); |
||
39 | } |
||
40 | } |
||
41 | } |
||
42 | |||
43 | public function onKernelRequest(GetResponseEvent $event) |
||
47 | } |
||
48 | |||
49 | |||
50 | public static function getSubscribedEvents() |
||
53 | } |
||
54 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.