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