Exceptions   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 36
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A columnNotSet() 0 4 1
A columnNotFound() 0 4 1
A numberUnValid() 0 4 1
A numberNotPositive() 0 4 1
1
<?php
2
3
namespace LarsJanssen\IncrementDecrement\Exceptions;
4
5
use Exception;
6
use Illuminate\Database\Eloquent\Model;
7
8
class Exceptions extends Exception
9
{
10
    /**
11
     * @param Model $model
12
     *
13
     * @return static
14
     */
15
    public static function columnNotFound(Model $model)
16
    {
17
        return new static("Could not find specified column on table `{$model->getTable()}`.");
18
    }
19
20
    /**
21
     * @return static
22
     */
23
    public static function columnNotSet()
24
    {
25
        return new static('Column not set in increment-decrement config file.');
26
    }
27
28
    /**
29
     * @return static
30
     */
31
    public static function numberUnValid($number)
32
    {
33
        return new static("Value `{$number}` is not a number.");
34
    }
35
36
    /**
37
     * @return static
38
     */
39
    public static function numberNotPositive($number)
40
    {
41
        return new static("Value `{$number}` must be positive.");
42
    }
43
}
44