Code Duplication    Length = 3-3 lines in 4 locations

src/Config/Controls.php 1 location

@@ 120-122 (lines=3) @@
117
     */
118
    public function fetchDelimitersOccurrence(array $delimiters, $nb_rows = 1)
119
    {
120
        if (!($nb_rows = filter_var($nb_rows, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]))) {
121
            throw new InvalidArgumentException('The number of rows to consider must be a valid positive integer');
122
        }
123
124
        $filterRow = function ($row) {
125
            return is_array($row) && count($row) > 1;

src/Plugin/ColumnConsistencyValidator.php 1 location

@@ 50-52 (lines=3) @@
47
     */
48
    public function setColumnsCount($value)
49
    {
50
        if (false === filter_var($value, FILTER_VALIDATE_INT, ['options' => ['min_range' => -1]])) {
51
            throw new InvalidArgumentException('the column count must an integer greater or equals to -1');
52
        }
53
        $this->detect_columns_count = false;
54
        $this->columns_count = $value;
55
    }

src/Reader.php 2 locations

@@ 199-201 (lines=3) @@
196
     */
197
    protected function assertValidColumnIndex($index)
198
    {
199
        if (false === filter_var($index, FILTER_VALIDATE_INT, ['options' => ['min_range' => 0]])) {
200
            throw new InvalidArgumentException('the column index must be a positive integer or 0');
201
        }
202
    }
203
204
    /**
@@ 303-305 (lines=3) @@
300
            return $offset_or_keys;
301
        }
302
303
        if (false === filter_var($offset_or_keys, FILTER_VALIDATE_INT, ['options' => ['min_range' => 0]])) {
304
            throw new InvalidArgumentException('the row index must be a positive integer, 0 or a non empty array');
305
        }
306
307
        $keys = $this->getRow($offset_or_keys);
308
        $this->assertValidAssocKeys($keys);