GeolocationDbUpdateFailedException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 19
rs 10
c 0
b 0
f 0
ccs 8
cts 8
cp 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A olderDbExists() 0 3 1
A create() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Shlinkio\Shlink\CLI\Exception;
6
7
use RuntimeException;
8
use Throwable;
9
10
class GeolocationDbUpdateFailedException extends RuntimeException implements ExceptionInterface
11
{
12
    private bool $olderDbExists;
13
14 13
    public static function create(bool $olderDbExists, ?Throwable $prev = null): self
15
    {
16 13
        $e = new self(
17 13
            'An error occurred while updating geolocation database, and an older version could not be found',
18 13
            0,
19
            $prev,
20
        );
21 13
        $e->olderDbExists = $olderDbExists;
22
23 13
        return $e;
24
    }
25
26 13
    public function olderDbExists(): bool
27
    {
28 13
        return $this->olderDbExists;
29
    }
30
}
31