Code Duplication    Length = 9-9 lines in 2 locations

src/CsvDialect.php 2 locations

@@ 109-117 (lines=9) @@
106
            if ($enclosed === null) {
107
                // start of a new field
108
                if ($char == $this->dialect["delimiter"]) {
109
                    if (
110
                        // delimiter at end of line
111
                        ($charPos == $lastCharPos)
112
                        // double delimiters
113
                        || ($charPos != $lastCharPos && mb_substr($line, $charPos+1, 1) == $this->dialect["delimiter"])
114
                    ) {
115
                        $field++;
116
                        $fields[$field] = "";
117
                    }
118
                    continue;
119
                } else {
120
                    $field++;
@@ 177-185 (lines=9) @@
174
                    throw new \Exception("Invalid csv file - if field is not enclosed with double quotes - then double quotes may not appear inside the field");
175
                } elseif ($char == $this->dialect["delimiter"]) {
176
                    // end of non-enclosed field + start of new field
177
                    if (
178
                        // delimiter at end of line
179
                        ($charPos == $lastCharPos)
180
                        // double delimiters
181
                        || ($charPos != $lastCharPos && mb_substr($line, $charPos+1, 1) == $this->dialect["delimiter"])
182
                    ) {
183
                        $field++;
184
                        $fields[$field] = "";
185
                    }
186
                    $enclosed = null;
187
                    continue;
188
                } else {