Conditions | 4 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
53 | public function __invoke(Request $request, Response $response, callable $next) |
||
54 | { |
||
55 | if (!$this->sentinel->check()) { |
||
56 | $this->flash->addMessage('error', 'You must be logged in to access this page!'); |
||
57 | |||
58 | return $response->withRedirect($this->router->pathFor('login')); |
||
59 | } elseif ($this->role && !$this->sentinel->inRole($this->role)) { |
||
60 | throw new AccessDeniedException($request, $response); |
||
61 | } |
||
62 | |||
63 | return $next($request, $response); |
||
64 | } |
||
65 | } |
||
66 |