1 | <?php declare(strict_types=1); |
||
15 | class AssertionFailedException extends \Exception |
||
16 | { |
||
17 | private $propertyPath; |
||
18 | private $value; |
||
19 | private $constraints; |
||
20 | private $level; |
||
21 | private $location; |
||
22 | |||
23 | /** |
||
24 | * AssertionFailedException constructor. |
||
25 | * @param string $message |
||
26 | * @param int $code |
||
27 | * @param string $propertyPath |
||
28 | * @param $value |
||
29 | * @param array $constraints |
||
30 | * @param string $level |
||
31 | */ |
||
32 | public function __construct(string $message, int $code, string $propertyPath = null, $value, array $constraints=[], string $level='critical') |
||
52 | |||
53 | /** |
||
54 | * User controlled way to define a sub-property causing |
||
55 | * the failure of a currently asserted objects. |
||
56 | * |
||
57 | * Useful to transport information about the nature of the error |
||
58 | * back to higher layers. |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | public function getPropertyPath() : string |
||
68 | |||
69 | /** |
||
70 | * @return null|string |
||
71 | */ |
||
72 | public function getProperty() : string |
||
76 | |||
77 | /** |
||
78 | * @return string |
||
79 | */ |
||
80 | public function getLevel() : string |
||
84 | |||
85 | /** |
||
86 | * @return string |
||
87 | */ |
||
88 | protected function getCallingFileAndLine() : string |
||
107 | |||
108 | /** |
||
109 | * @return object |
||
110 | */ |
||
111 | public function getLocation() |
||
115 | |||
116 | /** |
||
117 | * Get the value that caused the assertion to fail. |
||
118 | * |
||
119 | * @return mixed |
||
120 | */ |
||
121 | public function getValue() |
||
125 | /** |
||
126 | * Get the constraints that applied to the failed assertion. |
||
127 | * |
||
128 | * @return array |
||
129 | */ |
||
130 | public function getConstraints() |
||
134 | |||
135 | /** |
||
136 | * @param string $needle |
||
137 | * @param string $haystack |
||
138 | * @param bool $return_original |
||
139 | * @return string |
||
140 | */ |
||
141 | public static function afterLast(string $needle, string $haystack, bool $return_original=false) : string |
||
150 | |||
151 | /** |
||
152 | * @param string $string |
||
153 | * @param string $needle |
||
154 | * @return int |
||
155 | */ |
||
156 | public static function strrevpos(string $string, string $needle) : int |
||
162 | |||
163 | /** |
||
164 | * @param string $needle |
||
165 | * @param string $haystack |
||
166 | * @return string |
||
167 | */ |
||
168 | public static function beforeLast(string $needle, string $haystack) : string |
||
174 | } |
||
175 |