Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 31 lines (24 sloc) 766 Bytes
#!/usr/bin/env php
<?php
/**
* @author stev leibelt <artodeto@bazzline.net>
* @since 2015-06-24
*/
require_once __DIR__ . '/../vendor/autoload.php';
$factory = new \Net\Bazzline\Component\Csv\Reader\ReaderFactory();
$reader = $factory->create();
try {
$path = ($argc > 1) ? $argv[1] : __DIR__ . '/file/example.csv';
if (!file_exists($path)) {
throw new Exception('invalid file path provided: "' . $path . '"');
}
$reader->setPath($path);
while ($line = $reader()) {
echo implode("\t", $line) . PHP_EOL;
}
} catch (Exception $exception) {
echo 'usage: ' . basename(__FILE__) . ' [<path/to/csv>]' . PHP_EOL;
echo '----------------' . PHP_EOL;
echo $exception->getMessage() . PHP_EOL;
return 1;
}
You can’t perform that action at this time.