<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Filesystem\Input\Csv;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Filesystem\Text\BaseInputTextFile;
+use Org\Mxchange\CoreFramework\Stream\Filesystem\CsvInputStreamer;
+
+// Import SPL stuff
+use \SplFileInfo;
+
/**
* A CSV file input class for writing CSV files
*
/**
* Creates an instance of this File class and prepares it for usage
*
- * @param $fileName Name of the index file
+ * @param $infoInstance An instance of a SplFileInfo class
* @return $fileInstance An instance of this File class
*/
- public final static function createCsvInputFile ($fileName) {
+ public final static function createCsvInputFile (SplFileInfo $infoInstance) {
// Get a new instance
$fileInstance = new CsvInputFile();
- // Set file name
- $fileInstance->setFileName($fileName);
-
// Init this abstract file
- $fileInstance->initFile($fileName);
+ $fileInstance->initFile($infoInstance);
// Return the prepared instance
return $fileInstance;
$lineArray = array();
// Whether the parser reads a quoted string (which may contain the column separator again)
- $isInQuotes = FALSE;
+ $isInQuotes = false;
// Init column data
$column = '';
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] idx=%s,char=%s ...', __METHOD__, __LINE__, $idx, $char));
// Is the column separator found and not within quotes?
- if (($isInQuotes === FALSE) && ($char == $columnSeparator)) {
+ if (($isInQuotes === false) && ($char == $columnSeparator)) {
// Debug message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Adding column=%s ...', __METHOD__, __LINE__, $column));
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] column=%s ...', __METHOD__, __LINE__, $column));
// $column must be empty at this point if we are at starting quote
- assert(($isInQuotes === TRUE) || (empty($column)));
+ assert(($isInQuotes === true) || (empty($column)));
// Double-quote found, so flip variable
$isInQuotes = (!$isInQuotes);