Passed
Pull Request — master (#456)
by Alejandro
08:02
created

WrongIpException::fromIpAddress()   A

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 2
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\IpGeolocation\Exception;
5
6
use Shlinkio\Shlink\IpGeolocation\Exception\RuntimeException;
7
use Throwable;
8
9
use function sprintf;
10
11
class WrongIpException extends RuntimeException implements ExceptionInterface
12
{
13 7
    public static function fromIpAddress($ipAddress, ?Throwable $prev = null): self
14
    {
15 7
        return new self(sprintf('Provided IP "%s" is invalid', $ipAddress), 0, $prev);
16
    }
17
}
18