Completed
Push — develop ( 0bdcf1...3b506c )
by Enea
09:31 queued 08:05
created

UnauthorizedOwnerException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 80%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A makeMessage() 0 4 1
A __construct() 0 4 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