Passed
Push — master ( 85c419...35703b )
by Arthur
07:22
created

HandlesOwnership   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A isOwner() 0 6 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 29.10.18
6
 * Time: 16:14
7
 */
8
9
namespace Foundation\Traits;
10
11
12
use Foundation\Contracts\Ownable;
13
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
14
15
trait HandlesOwnership
16
{
17
    public function isOwner(?Ownable $model){
18
19
        if($model === null)
20
            throw new NotFoundHttpException("Could not found resouce.");
21
22
        $this->authorize('access', $model);
0 ignored issues
show
Bug introduced by
It seems like authorize() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        $this->/** @scrutinizer ignore-call */ 
23
               authorize('access', $model);
Loading history...
23
    }
24
}
25