SImplify separator inference code (#903)
This commit is contained in:
parent
df1085505c
commit
f26023586e
|
@ -155,7 +155,7 @@ class Csv extends BaseReader
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$potentialDelimiters = [',', ';', "\t", '|', ':', ' '];
|
$potentialDelimiters = [',', ';', "\t", '|', ':', ' ', '~'];
|
||||||
$counts = [];
|
$counts = [];
|
||||||
foreach ($potentialDelimiters as $delimiter) {
|
foreach ($potentialDelimiters as $delimiter) {
|
||||||
$counts[$delimiter] = [];
|
$counts[$delimiter] = [];
|
||||||
|
@ -258,11 +258,8 @@ class Csv extends BaseReader
|
||||||
$line = preg_replace('/(' . $enclosure . '.*' . $enclosure . ')/U', '', $line);
|
$line = preg_replace('/(' . $enclosure . '.*' . $enclosure . ')/U', '', $line);
|
||||||
|
|
||||||
// See if we have any enclosures left in the line
|
// See if we have any enclosures left in the line
|
||||||
$matches = [];
|
// if we still have an enclosure then we need to read the next line as well
|
||||||
preg_match('/(' . $enclosure . ')/', $line, $matches);
|
if (preg_match('/(' . $enclosure . ')/', $line) > 0) {
|
||||||
|
|
||||||
// if we still have an enclosure then we need to read the next line aswell
|
|
||||||
if (count($matches) > 0) {
|
|
||||||
$line = $this->getNextLine($line);
|
$line = $this->getNextLine($line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue