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

AddressNotSortableException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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