Guardian   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A restricted() 0 6 2
1
<?php
2
3
namespace EmilMoe\Guardian\Http;
4
5
use Illuminate\Support\Facades\Redirect;
6
use Symfony\Component\HttpKernel\Exception\HttpException;
7
8
class Guardian
9
{
10
    /**
11
     * Method called when user tries to access a page without permission.
12
     *
13
     * @return HttpException|Redirect
14
     */
15
    public static function restricted()
16
    {
17
        return config('guardian.redirect') == null
18
            ? abort(403, 'Unauthorized access.')
19
            : Redirect::to(config('guardian.redirect'));
20
    }
21
}