Authorizable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A abortIfCant() 0 7 2
1
<?php
2
3
namespace Ianrizky\Illuminate\Foundation\Auth\Access;
4
5
use Illuminate\Foundation\Auth\Access\Authorizable as BaseAuthorizable;
6
use Illuminate\Http\Response;
7
8
trait Authorizable
9
{
10
    use BaseAuthorizable;
11
12
    /**
13
     * Throw an HttpException if the entity has the given abilities.
14
     *
15
     * @param  iterable|string  $abilities
16
     * @param  array|mixed  $arguments
17
     * @return $this
18
     *
19
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
20
     */
21
    public function abortIfCant($abilities, $arguments = [])
22
    {
23
        if ($this->cant($abilities, $arguments)) {
24
            abort(Response::HTTP_FORBIDDEN);
25
        }
26
27
        return $this;
28
    }
29
}
30