File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types = 1 );
4
+
5
+ namespace PHPModelGenerator \Exception \Object ;
6
+
7
+ use Exception ;
8
+ use PHPModelGenerator \Exception \ValidationException ;
9
+
10
+ /**
11
+ * Class NotAllowedAdditionalPropertiesException
12
+ *
13
+ * @package PHPModelGenerator\Exception\Object
14
+ */
15
+ class NestedObjectException extends ValidationException
16
+ {
17
+ /** @var Exception */
18
+ private $ nestedException ;
19
+
20
+ /**
21
+ * NotAllowedAdditionalPropertiesException constructor.
22
+ *
23
+ * @param $providedValue
24
+ * @param string $propertyName
25
+ * @param Exception $nestedException
26
+ */
27
+ public function __construct ($ providedValue , string $ propertyName , Exception $ nestedException )
28
+ {
29
+ $ this ->nestedException = $ nestedException ;
30
+
31
+ parent ::__construct (
32
+ "Invalid nested object for property $ propertyName: \n - " .
33
+ preg_replace (
34
+ "/ \n([^\s])/m " ,
35
+ "\n - $1 " ,
36
+ preg_replace ("/ \n\s/m " , "\n " , $ nestedException ->getMessage ())
37
+ ),
38
+ $ propertyName ,
39
+ $ providedValue
40
+ );
41
+ }
42
+
43
+ /**
44
+ * @return Exception
45
+ */
46
+ public function getNestedException (): Exception
47
+ {
48
+ return $ this ->nestedException ;
49
+ }
50
+ }
You can’t perform that action at this time.
0 commit comments