Completed
Push — master ( ab4a72...99f0f9 )
by Sergey
05:20
created

ModelNotFoundException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 88.89%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 17
ccs 8
cts 9
cp 0.8889
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 2
1
<?php
2
3
namespace Isswp101\Persimmon\Exceptions;
4
5
use Illuminate\Database\Eloquent\ModelNotFoundException as Exception;
6
use ReflectionClass;
7
8
class ModelNotFoundException extends Exception
9
{
10 2
    public function __construct($class, $id = null)
11
    {
12 2
        $reflection = new ReflectionClass($class);
13
14 2
        $model = $reflection->getShortName();
15
16 2
        if ($id) {
17 2
            $message = sprintf('Model `%s` not found by id `%s`', $model, $id);
18 2
        } else {
19
            $message = sprintf('Model `%s` not found', $model);
20
        }
21
22 2
        parent::__construct($message);
23 2
    }
24
}
25