CascadeSoftDeleteException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A softDeleteNotImplemented() 0 4 1
A invalidRelationships() 0 8 1
1
<?php
2
3
namespace Iatstuti\Database\Support;
4
5
use Exception;
6
use Illuminate\Support\Str;
7
8
class CascadeSoftDeleteException extends Exception
9
{
10
    public static function softDeleteNotImplemented($class)
11
    {
12
        return new static(sprintf('%s does not implement Illuminate\Database\Eloquent\SoftDeletes', $class));
13
    }
14
15
16
    public static function invalidRelationships($relationships)
17
    {
18
        return new static(sprintf(
19
            '%s [%s] must exist and return an object of type Illuminate\Database\Eloquent\Relations\Relation',
20
            Str::plural('Relationship', count($relationships)),
21
            join(', ', $relationships)
22
        ));
23
    }
24
}
25