11 class Csv extends \Magento\ImportExport\Model\Import\AbstractSource
43 \
Magento\Framework\Filesystem\Directory\Read $directory,
47 register_shutdown_function([$this,
'destruct']);
49 $this->_file = $directory->openFile($directory->getRelativePath($file),
'r');
50 }
catch (\
Magento\Framework\Exception\FileSystemException $e) {
51 throw new \LogicException(
"Unable to open file: '{$file}'");
54 $this->_delimiter = $delimiter;
56 $this->_enclosure = $enclosure;
67 if (is_object($this->_file)) {
68 $this->_file->close();
79 $parsed = $this->_file->readCsv(0, $this->_delimiter, $this->_enclosure);
80 if (is_array($parsed) && count($parsed) != $this->_colQty) {
82 if (strpos(
$element,
"'") !==
false) {
83 $this->_foundWrongQuoteFlag =
true;
88 $this->_foundWrongQuoteFlag =
false;
90 return is_array($parsed) ? $parsed : [];
100 $this->_file->seek(0);
__construct( $file, \Magento\Framework\Filesystem\Directory\Read $directory, $delimiter=',', $enclosure='"' )