PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.2.2
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.2.2
2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 All 67 releases
better-payment / vendor / league / csv / src / SyntaxError.php

SyntaxError.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 2.2.2, at vendor/league/csv/src/SyntaxError.php

61 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * League.Csv (https://csv.thephpleague.com)
5 *
6 * (c) Ignace Nyamagana Butera <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 declare(strict_types=1);
13
14 namespace League\Csv;
15
16 use Throwable;
17
18 /**
19 * SyntaxError Exception.
20 */
21 class SyntaxError extends Exception
22 {
23 /**
24 * @var array<string>
25 */
26 protected array $duplicateColumnNames = [];
27
28 /**
29 * DEPRECATION WARNING! This class will be removed in the next major point release.
30 *
31 * @deprecated since version 9.7.0
32 */
33 public function __construct(string $message = '', int $code = 0, Throwable $previous = null)
34 {
35 parent::__construct($message, $code, $previous);
36 }
37
38 public static function dueToHeaderNotFound(int $offset): self
39 {
40 return new self('The header record does not exist or is empty at offset: `'.$offset.'`');
41 }
42
43 public static function dueToInvalidHeaderColumnNames(): self
44 {
45 return new self('The header record contains non string colum names.');
46 }
47
48 public static function dueToDuplicateHeaderColumnNames(array $header): self
49 {
50 $instance = new self('The header record contains duplicate column names.');
51 $instance->duplicateColumnNames = array_keys(array_filter(array_count_values($header), fn (int $value): bool => $value > 1));
52
53 return $instance;
54 }
55
56 public function duplicateColumnNames(): array
57 {
58 return $this->duplicateColumnNames;
59 }
60 }
61