Skip to content

New Class BigCsv

Latest
Compare
Choose a tag to compare
@dbierer dbierer released this 29 Mar 02:38
· 3 commits to main since this release

FileCMS\Common\Data\BigCsv

  • New class
  • Handles files of any size
  • Doesn't use file()
  • Low memory consumption
  • Not as fast as Csv

FileCMS\Common\Data\CsvTrait

  • Hold common constants and methods
  • Used by Csv and BigCsv
  • Added new method array_combine_whatever()
    • If header count === data count runs array_combine()
    • If header count < data count starts creating headers header_01, header_02 etc.
    • If header count > data count just assigns the headers to the data items and drops remaining headers

FileCMS\Common\Data\Csv

  • Refactored slightly to use CsvTrait
  • Added flag $all to findItemInCSV()
    • If set FALSE (default) only returns 1st match
    • If set TRUE returns all matching rows

TODO

  • Move array_combine_whatever() to a generic class w/ static usage
  • Set up CsvTrait::array_combine_whatever() to make a static call to this generic class