Passed
Push — master ( 5d0b97...9f4c0c )
by Guillaume
02:33
created

InvalidArgumentException::getPropertyPath()   A

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 Imedia\Ammit\UI\Resolver\Validator;
5
6
/**
7
 * @author Guillaume MOREL <[email protected]>
8
 */
9
class InvalidArgumentException extends \InvalidArgumentException
10
{
11
    /** @var string|null */
12
    private $propertyPath;
13
14
    /** @var mixed */
15
    private $value;
16
17
    public function __construct($message, int $code = 0, string $propertyPath = null, $value)
18
    {
19
        parent::__construct($message, $code);
20
21
        $this->propertyPath = $propertyPath;
22
        $this->value = $value;
23
    }
24
25
    /**
26
     * User controlled way to define a sub-property causing
27
     * the failure of a currently asserted objects.
28
     *
29
     * Useful to transport information about the nature of the error
30
     * back to higher layers.
31
     *
32
     * @return string|null
33
     */
34
    public function getPropertyPath()
35
    {
36
        return $this->propertyPath;
37
    }
38
39
    /**
40
     * Get the value that caused the assertion to fail.
41
     *
42
     * @return mixed
43
     */
44
    public function getValue()
45
    {
46
        return $this->value;
47
    }
48
}
49