for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace MarcusJaschen\Collmex\Csv;
use League\Csv\Reader;
/**
* CSV Parser Implementation using Keboola CSV Reader
*
* @author Marcus Jaschen <[email protected]>
* @license http://www.opensource.org/licenses/mit-license MIT License
* @link https://github.com/mjaschen/collmex
* @link https://github.com/keboola/php-csv
*/
class LeagueCsvParser implements ParserInterface
{
* @var string
protected $delimiter;
protected $enclosure;
* @param string $delimiter
* @param string $enclosure
public function __construct($delimiter = ';', $enclosure = '"')
$this->delimiter = $delimiter;
$this->enclosure = $enclosure;
}
* @param string $csv one or multiple lines of CSV data
* @return array
* @throws \InvalidArgumentException
public function parse($csv)
$input = Reader::createFromString($csv);
$input->setDelimiter($this->delimiter);
$input->setEnclosure($this->enclosure);
return $input->fetchAll();