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

UnauthorizedOwnerException::makeMessage()   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

Importance

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