1 | <?php |
||
28 | class CannotInsertRecord extends RuntimeException implements Exception |
||
29 | { |
||
30 | /** |
||
31 | * The record submitted for insertion |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $record; |
||
36 | |||
37 | /** |
||
38 | * Validator which did not validated the data |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $name = ''; |
||
43 | |||
44 | /** |
||
45 | * Create an Exception from a record insertion into a stream |
||
46 | * |
||
47 | * @param string[] $record |
||
48 | * |
||
49 | * @return self |
||
50 | */ |
||
51 | 2 | public static function createFromStream(array $record): self |
|
58 | |||
59 | /** |
||
60 | * Create an Exception from a Record Validation |
||
61 | * |
||
62 | * @param string $name validator name |
||
63 | * @param string[] $record invalid data |
||
64 | * |
||
65 | * @return self |
||
66 | */ |
||
67 | 6 | public static function createFromValidator(string $name, array $record): self |
|
75 | |||
76 | /** |
||
77 | * return the validator name |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | 2 | public function getName(): string |
|
85 | |||
86 | /** |
||
87 | * return the invalid data submitted |
||
88 | * |
||
89 | * @return array |
||
90 | */ |
||
91 | 4 | public function getRecord(): array |
|
95 | } |
||
96 |