InvalidArgumentException::getValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace AmmitPhp\Ammit\UI\Resolver\Validator;
5
6
class InvalidArgumentException extends \InvalidArgumentException
7
{
8
    /** @var string|null */
9
    private $propertyPath;
10
11
    /** @var mixed */
12
    private $value;
13
14
    public function __construct($message, int $code = 0, string $propertyPath = null, $value)
15
    {
16
        parent::__construct($message, $code);
17
18
        $this->propertyPath = $propertyPath;
19
        $this->value = $value;
20
    }
21
22
    /**
23
     * User controlled way to define a sub-property causing
24
     * the failure of a currently asserted objects.
25
     *
26
     * Useful to transport information about the nature of the error
27
     * back to higher layers.
28
     *
29
     * @return string|null
30
     */
31
    public function getPropertyPath()
32
    {
33
        return $this->propertyPath;
34
    }
35
36
    /**
37
     * Get the value that caused the assertion to fail.
38
     *
39
     * @return mixed
40
     */
41
    public function getValue()
42
    {
43
        return $this->value;
44
    }
45
}
46