Passed
Push — master ( 0a787f...f7fce9 )
by refat
05:37
created

RedirectMiddleware   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 10 3
1
<?php
2
3
namespace App\Middleware;
4
5
use System\Application;
6
use App\Middleware\MiddlewaresInterface as Middleware;
7
8
class RedirectMiddleware implements Middleware
9
{
10
  public function handle(Application $app, $next)
11
  {
12
13
    if (!$this->session->has('error') || $this->session->get('error') != true) {
14
15
      $this->url->redirectTo('/');
16
17
    } else {
18
19
      $this->session->remove('error');
20
    }
21
  }
22
}