Completed
Branch develop (8ca1e6)
by Enea
06:41
created

UnauthorizedOwnerException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 12
ccs 6
cts 7
cp 0.8571
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A makeMessage() 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 4
class UnauthorizedOwnerException extends UnauthorizedException
11
{
12 12
    public function __construct(Model $model, array $headers = array())
13
    {
14 8
        parent::__construct($this->makeMessage($model), $headers);
15 4
    }
16
17 12
    private function makeMessage(Model $model): string
18
    {
19 8
        return "{$model->getMorphClass()} with key {$model->getKey()} is not authorized";
20
    }
21
}
22