Passed
Branch develop (f66584)
by Enea
02:08
created

UnauthorizedOwnerException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A makeMessage() 0 3 1
A __construct() 0 3 1
1
<?php
2
/**
3
 * Created on 10/03/18 by enea dhack.
4
 */
5
6
namespace Enea\Authorization\Exceptions;
7
8
use Illuminate\Database\Eloquent\Model;
9
10
class UnauthorizedOwnerException extends UnauthorizedException
11
{
12 12
    public function __construct(Model $model, array $headers = array())
13
    {
14 12
        parent::__construct($this->makeMessage($model), $headers);
15
    }
16
17 12
    private function makeMessage(Model $model): string
18
    {
19 12
        return "{$model->getMorphClass()} with key {$model->getKey()} is not authorized";
20
    }
21
}
22