AbstractCsv.php
2 months ago
ByteSequence.php
2 months ago
CannotInsertRecord.php
2 months ago
CharsetConverter.php
2 months ago
ColumnConsistency.php
2 months ago
EncloseField.php
2 months ago
EscapeFormula.php
2 months ago
Exception.php
2 months ago
HTMLConverter.php
2 months ago
Info.php
2 months ago
InvalidArgument.php
2 months ago
MapIterator.php
2 months ago
RFC4180Field.php
2 months ago
Reader.php
2 months ago
ResultSet.php
2 months ago
Statement.php
2 months ago
Stream.php
2 months ago
SyntaxError.php
2 months ago
TabularDataReader.php
2 months ago
UnableToProcessCsv.php
2 months ago
UnavailableFeature.php
2 months ago
UnavailableStream.php
2 months ago
Writer.php
2 months ago
XMLConverter.php
2 months ago
functions.php
2 months ago
functions_include.php
2 months ago
SyntaxError.php
52 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * League.Csv (https://csv.thephpleague.com) |
| 5 | * |
| 6 | * (c) Ignace Nyamagana Butera <nyamsprod@gmail.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | declare (strict_types=1); |
| 12 | namespace ProfilePressVendor\League\Csv; |
| 13 | |
| 14 | use Throwable; |
| 15 | /** |
| 16 | * SyntaxError Exception. |
| 17 | */ |
| 18 | class SyntaxError extends Exception |
| 19 | { |
| 20 | /** |
| 21 | * @var array<string> |
| 22 | */ |
| 23 | protected array $duplicateColumnNames = []; |
| 24 | /** |
| 25 | * DEPRECATION WARNING! This class will be removed in the next major point release. |
| 26 | * |
| 27 | * @deprecated since version 9.7.0 |
| 28 | */ |
| 29 | public function __construct(string $message = '', int $code = 0, Throwable $previous = null) |
| 30 | { |
| 31 | parent::__construct($message, $code, $previous); |
| 32 | } |
| 33 | public static function dueToHeaderNotFound(int $offset): self |
| 34 | { |
| 35 | return new self('The header record does not exist or is empty at offset: `' . $offset . '`'); |
| 36 | } |
| 37 | public static function dueToInvalidHeaderColumnNames(): self |
| 38 | { |
| 39 | return new self('The header record contains non string colum names.'); |
| 40 | } |
| 41 | public static function dueToDuplicateHeaderColumnNames(array $header): self |
| 42 | { |
| 43 | $instance = new self('The header record contains duplicate column names.'); |
| 44 | $instance->duplicateColumnNames = array_keys(array_filter(array_count_values($header), fn(int $value): bool => $value > 1)); |
| 45 | return $instance; |
| 46 | } |
| 47 | public function duplicateColumnNames(): array |
| 48 | { |
| 49 | return $this->duplicateColumnNames; |
| 50 | } |
| 51 | } |
| 52 |