diff --git a/src/UsesParsers.php b/src/UsesParsers.php index e93e783..c3b261e 100644 --- a/src/UsesParsers.php +++ b/src/UsesParsers.php @@ -129,15 +129,15 @@ public function csvDecodeWithHeader( } // Helper method to cast types - protected function castType(string $entry) + public function castType(string $entry) { // Looks like an int? - if ($entry == (int) $entry) { + if ($entry == (string) (int) $entry) { return (int) $entry; } // Looks like a float? - if ($entry == (float) $entry) { + if ($entry == (string) (float) $entry) { return (float) $entry; } @@ -145,6 +145,9 @@ protected function castType(string $entry) } + + + /** * A boilerplate function to process the various calling options for `parseX` functions. */ @@ -235,12 +238,27 @@ public function parseCsv(?string $csvStringOrUrl = null): array } - // // Associate - // $csv = array_map('str_getcsv', file($file)); - // array_walk($csv, function(&$a) use ($csv) { - // $a = array_combine($csv[0], $a); - // }); - // array_shift($csv); + + + + + + + + + + + + + + + + + + + + +