Passed
Branch master (3ad5d4)
by refat
26:57
created

AjaxMiddleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 8
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 6 2
1
<?php
2
3
namespace app\Middlewares;
4
5
use System\Application;
6
use app\Middlewares\MiddlewareIntrerface\MiddlewaresInterface as Middleware;
7
8
class AjaxMiddleware implements Middleware
9
{
10
  public function handle(Application $app, $next)
11
  {
12
    if (empty($_SERVER['HTTP_X_REQUESTED_WITH'])) {
13
      return $app->url->redirectTo('404');
14
    }
15
    return $next;
16
  }
17
}
18