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

UnauthorizedOwnerException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.037

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 3
cp 0.6667
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1.037
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