TrackingMiddleware   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
eloc 3
c 2
b 0
f 0
dl 0
loc 15
ccs 3
cts 3
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 5 1
1
<?php
2
3
/**
4
 * TrackingMiddleware.php
5
 *
6
 * This middleware will intercept traffic from visitors to
7
 * your website.
8
 *
9
 * PHP version 7.2
10
 *
11
 * @category Middleware
12
 * @package  RedboxTracker
13
 * @author   Johnny Mast <[email protected]>
14
 * @license  https://opensource.org/licenses/MIT MIT
15
 * @link     https://github.com/johnnymast/redbox-tracker
16
 * @since    GIT:1.0
17
 */
18
19
namespace Redbox\Tracker\Middleware;
20
21
use Redbox\Tracker\Facades\Tracker;
22
use Closure;
23
24
/**
25
 * TrackingMiddleware class
26
 *
27
 * Model for website visitor requests.
28
 *
29
 * @category Middleware
30
 * @package  RedboxTracker
31
 * @author   Johnny Mast <[email protected]>
32
 * @license  https://opensource.org/licenses/MIT MIT
33
 * @link     https://github.com/johnnymast/redbox-tracker
34
 * @since    GIT:1.0
35
 */
36
class TrackingMiddleware
37
{
38
    /**
39
     * Get the path the user should be redirected to when they are not authenticated.
40
     *
41
     * @param \Illuminate\Http\Request $request The incoming request
42
     * @param Closure                  $next    The next Middleware to execute.
43
     *
44
     * @return mixed
45
     */
46 18
    public function handle($request, Closure $next)
47
    {
48 18
        Tracker::recordVisit();
49
        
50 16
        return $next($request);
51
    }
52
}
53