Completed
Push — master ( 2c69ad...5eb3ba )
by Alexis
01:46
created

GuestMiddleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 2
1
<?php
2
3
namespace Security\Middleware;
4
5
use App\Middleware\Middleware;
6
use Slim\Http\Request;
7
use Slim\Http\Response;
8
9
class GuestMiddleware extends Middleware
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function __invoke(Request $request, Response $response, callable $next)
15
    {
16
        if ($this->auth->check()) {
17
            return $response->withRedirect($this->router->pathFor('home'));
18
        }
19
20
        return $next($request, $response);
21
    }
22
}
23