public function test_line_is_parsed()
 {
     $aOperationLine = "0121-04-201545111079993487741253  50294909XXXXXXXX0846    VXDN20-04-201500312431256005ON 00000001000+00005000000002+0000000000998+0032724325901                                      EUR001407642293      0000000000000+                                  \n";
     $aLineStructure = ['Tipo de registro' => [2, '01'], 'Valor' => [10], 'Remesa' => [10], 'Factura' => [12]];
     $parsed = FileProcessor::parseLine($aOperationLine, $aLineStructure);
     $this->assertEquals('21-04-2015', $parsed['Valor']);
 }
Example #2
0
#!/usr/local/bin/php
<?php 
require __DIR__ . '/../vendor/autoload.php';
use Consigment\FileProcessor;
$files = [];
if (empty($argv[1])) {
    $files = glob('./*.txt');
    if (!count($files)) {
        die('File to parse undefined');
    } else {
        echo "Automatically selected every .txt file of this folder" . PHP_EOL;
    }
} else {
    $files = [$argv[1]];
}
$structureInfo = (require __DIR__ . '/config/bank_pos_payment.php');
foreach ($files as $file) {
    echo 'Process ' . $file . PHP_EOL;
    FileProcessor::processFile($file, $structureInfo);
}
echo "done!" . PHP_EOL;