示例#1
0
文件: module.php 项目: cmykna/pestle
/**
* One Line Description
*
* @command csv_to_iif
* @argument path_to_file CSV File
*/
function pestle_cli($argv)
{
    extract($argv);
    $handle = fopen($path_to_file, 'r');
    $process_function = false;
    while ($line = fgetcsv($handle)) {
        if (!$process_function) {
            $process_function = getProcessFunctionFromFirstLine($line);
        }
        call_user_func($process_function, $line);
    }
    output("Hello Sailor");
}
示例#2
0
文件: all.php 项目: astorm/pestle
/**
* One Line Description
*
* @command csv_to_iif
* @argument path_to_file CSV File
*/
function pestle_cli($argv)
{
    extract($argv);
    $handle = fopen($path_to_file, 'r');
    $process_function = false;
    $iifs = [];
    while ($line = fgetcsv($handle)) {
        if (!$process_function) {
            $process_function = getProcessFunctionFromFirstLine($line);
        }
        $iifs[] = call_user_func($process_function, $line);
    }
    $iifs = array_filter($iifs);
    $iifs = array_reverse($iifs);
    \Pulsestorm\Pestle\Library\output('!TRNS	DATE	ACCNT	NAME	CLASS	AMOUNT	MEMO
!SPL	DATE	ACCNT	NAME	AMOUNT	MEMO
!ENDTRNS');
    \Pulsestorm\Pestle\Library\output(implode("\n", $iifs));
}