Passed
Pull Request — master (#456)
by Alejandro
06:37 queued 01:57
created

WrongIpException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 5
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromIpAddress() 0 3 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