olderDbExists()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 0
crap 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