1 | <?php |
||
25 | class CannotInsertRecord extends Exception |
||
26 | { |
||
27 | /** |
||
28 | * The record submitted for insertion |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $record; |
||
33 | |||
34 | /** |
||
35 | * Validator which did not validated the data |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $name = ''; |
||
40 | |||
41 | /** |
||
42 | * Create an Exception from a record insertion into a stream |
||
43 | * |
||
44 | * @param string[] $record |
||
45 | * |
||
46 | * @return self |
||
47 | */ |
||
48 | 2 | public static function triggerOnInsertion(array $record): self |
|
55 | |||
56 | /** |
||
57 | * Create an Exception from a Record Validation |
||
58 | * |
||
59 | * @param string $name validator name |
||
60 | * @param string[] $record invalid data |
||
61 | * |
||
62 | * @return self |
||
63 | */ |
||
64 | 6 | public static function triggerOnValidation(string $name, array $record): self |
|
72 | |||
73 | /** |
||
74 | * return the validator name |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | 2 | public function getName(): string |
|
82 | |||
83 | /** |
||
84 | * return the invalid data submitted |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | 4 | public function getRecord(): array |
|
92 | } |
||
93 |