mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
small code improvement
This commit is contained in:
@@ -64,7 +64,7 @@ trait DatatypeTrait {
|
|||||||
$result = [];
|
$result = [];
|
||||||
foreach ($this->titles as $cName) {
|
foreach ($this->titles as $cName) {
|
||||||
$column = array_column($this->data, $cName);
|
$column = array_column($this->data, $cName);
|
||||||
$cDatatypes = array_map('ParseCsv\enums\DatatypeEnum::getValidTypeFromSample', $column);
|
$cDatatypes = array_map(DatatypeEnum::class . '::getValidTypeFromSample', $column);
|
||||||
|
|
||||||
$result[$cName] = $this->getMostFrequentDatatypeForColumn($cDatatypes);
|
$result[$cName] = $this->getMostFrequentDatatypeForColumn($cDatatypes);
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ trait DatatypeTrait {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$firstRowDatatype = array_map('ParseCsv\enums\DatatypeEnum::getValidTypeFromSample', $firstRow);
|
$firstRowDatatype = array_map(DatatypeEnum::class . '::getValidTypeFromSample', $firstRow);
|
||||||
|
|
||||||
if ($this->getMostFrequentDatatypeForColumn($firstRowDatatype) !== DatatypeEnum::TYPE_STRING){
|
if ($this->getMostFrequentDatatypeForColumn($firstRowDatatype) !== DatatypeEnum::TYPE_STRING){
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user