文字コード判定と必須列のチェックまで
This commit is contained in:
29
app/Exceptions/CsvImportException.php
Normal file
29
app/Exceptions/CsvImportException.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class CsvImportException extends \RuntimeException
|
||||
{
|
||||
/** @var string[] */
|
||||
private $errors;
|
||||
|
||||
/**
|
||||
* CsvImportException constructor.
|
||||
* @param string[] $errors
|
||||
*/
|
||||
public function __construct(array $errors)
|
||||
{
|
||||
parent::__construct(array_first($errors));
|
||||
$this->errors = $errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getErrors(): array
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user