CannotCreateDisk   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
eloc 6
c 2
b 1
f 0
dl 0
loc 13
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A diskNotDefined() 0 11 2
1
<?php
2
3
namespace Spatie\DbSnapshots\Exceptions;
4
5
use Exception;
6
7
class CannotCreateDisk extends Exception
8
{
9
    public static function diskNotDefined(string $diskName): self
10
    {
11
        $disks = config('filesystems.disks', null);
12
13
        if (! $disks) {
14
            return new static("Cannot create a disk `{$diskName}`. There are no disks set up.");
15
        }
16
17
        $existingDiskNames = implode(', ', array_keys($disks));
18
19
        return new static("Cannot create a disk `{$diskName}`. Known disknames are {$existingDiskNames}.");
20
    }
21
}
22