Completed
Push — master ( 0433ef...685874 )
by Sebastian
03:38
created

MediaCannotBeDeleted::doesNotBelongToModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Spatie\MediaLibrary\Exceptions;
4
5
use Exception;
6
use Illuminate\Database\Eloquent\Model;
7
use Spatie\MediaLibrary\Media;
8
9
class MediaCannotBeDeleted extends Exception
10
{
11
    public static function doesNotBelongToModel(Media $media, Model $model)
12
    {
13
        $modelClass = get_class($model);
14
15
        return new static("Media with id {$media->getKey()} cannot be deleted because it does not belong to model {$modelClass} with id {$model->id}");
16
    }
17
}
18