InvalidCheckDefinition   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A unknownCheckType() 0 6 1
A definitionClassDoesNotExist() 0 4 1
1
<?php
2
3
namespace Spatie\ServerMonitor\Exceptions;
4
5
use Exception;
6
use Spatie\ServerMonitor\Models\Check;
7
8
class InvalidCheckDefinition extends Exception
9
{
10
    public static function unknownCheckType(Check $check)
11
    {
12
        $validValues = implode(', ', array_keys(config('server-monitor.checks')));
13
14
        return new static("The check with id `{$check->id}` has an unknown type `{$check->type}`. Valid values are {$validValues}");
15
    }
16
17
    public static function definitionClassDoesNotExist(Check $check, string $definitionClass)
18
    {
19
        return new static("The definition class {$definitionClass} specified in the configfile as `{$check->type}` does not exist");
20
    }
21
}
22