Passed
Push — master ( fc0629...9e5c60 )
by Edward
05:11
created

AddressNotSortableException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAddress() 0 3 1
A __construct() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Path\Runtime\Matcher\Exception;
5
6
use DomainException;
7
use Throwable;
8
9
final class AddressNotSortableException extends DomainException implements ExceptionInterface
10
{
11
12
    private $address;
13
14
    /**
15
     * @param int|string     $address
16
     * @param Throwable|null $previous
17
     */
18
    public function __construct($address, Throwable $previous = null)
19
    {
20
        $this->address = $address;
21
        parent::__construct("Index/property is not sortable: {$this->address}", $previous);
0 ignored issues
show
Bug introduced by
It seems like $previous can also be of type Throwable; however, parameter $code of Exception::__construct() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
        parent::__construct("Index/property is not sortable: {$this->address}", /** @scrutinizer ignore-type */ $previous);
Loading history...
22
    }
23
24
    /**
25
     * @return int|string
26
     */
27
    public function getAddress()
28
    {
29
        return $this->address;
30
    }
31
}
32