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 / TabularDataReader.php

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

118 lines 3.8 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 Countable;
17 use Iterator;
18 use IteratorAggregate;
19
20 /**
21 * Represents a Tabular data.
22 *
23 * @method Iterator fetchColumnByName(string $name) returns a column from its name
24 * @method Iterator fetchColumnByOffset(int $offset) returns a column from its offset
25 */
26 interface TabularDataReader extends Countable, IteratorAggregate
27 {
28 /**
29 * Returns the number of records contained in the tabular data structure
30 * excluding the header record.
31 */
32 public function count(): int;
33
34 /**
35 * Returns the tabular data records as an iterator object.
36 *
37 * Each record is represented as a simple array containing strings or null values.
38 *
39 * If the CSV document has a header record then each record is combined
40 * to the header record and the header record is removed from the iterator.
41 *
42 * If the CSV document is inconsistent. Missing record fields are
43 * filled with null values while extra record fields are strip from
44 * the returned object.
45 */
46 public function getIterator(): Iterator;
47
48 /**
49 * Returns the header associated with the tabular data.
50 *
51 * The header must contains unique string or is an empty array
52 * if no header was specified.
53 *
54 * @return array<string>
55 */
56 public function getHeader(): array;
57
58 /**
59 * Returns the tabular data records as an iterator object.
60 *
61 * Each record is represented as a simple array containing strings or null values.
62 *
63 * If the tabular data has a header record then each record is combined
64 * to the header record and the header record is removed from the iterator.
65 *
66 * If the tabular data is inconsistent. Missing record fields are
67 * filled with null values while extra record fields are strip from
68 * the returned object.
69 *
70 * @param array<string> $header an optional header to use instead of the CSV document header
71 */
72 public function getRecords(array $header = []): Iterator;
73
74 /**
75 * Returns the nth record from the tabular data.
76 *
77 * By default if no index is provided the first record of the tabular data is returned
78 *
79 * @param int $nth_record the tabular data record offset
80 *
81 * @throws UnableToProcessCsv if argument is lesser than 0
82 */
83 public function fetchOne(int $nth_record = 0): array;
84
85 /**
86 * DEPRECATION WARNING! This class will be removed in the next major point release.
87 *
88 * @deprecated since version 9.8.0
89 *
90 * @see ::fetchColumnByName
91 * @see ::fetchColumnByOffset
92 *
93 * Returns a single column from the next record of the tabular data.
94 *
95 * By default if no value is supplied the first column is fetch
96 *
97 * @param string|int $index CSV column index
98 *
99 * @throws UnableToProcessCsv if the column index is invalid or not found
100 */
101 public function fetchColumn($index = 0): Iterator;
102
103 /**
104 * Returns the next key-value pairs from the tabular data (first
105 * column is the key, second column is the value).
106 *
107 * By default if no column index is provided:
108 * - the first column is used to provide the keys
109 * - the second column is used to provide the value
110 *
111 * @param string|int $offset_index The column index to serve as offset
112 * @param string|int $value_index The column index to serve as value
113 *
114 * @throws UnableToProcessCsv if the column index is invalid or not found
115 */
116 public function fetchPairs($offset_index = 0, $value_index = 1): Iterator;
117 }
118