예제 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $parser = new CsvStandardParser();
     $standardfilename = $input->getArgument('standardfilename');
     $csvdata = file_get_contents($standardfilename);
     $standard = $parser->parse($csvdata);
     $messagefilename = $input->getArgument('messagefilename');
     $messagedata = file_get_contents($messagefilename);
     $messageparser = new MessageParser();
     $message = $messageparser->parse($standard, $messagedata);
     //print_r($message->getRecords());
     $o = '';
     foreach ($message->getRecords() as $r) {
         $code = $r->getCode();
         $recordType = $standard->getRecordType($code);
         $name = $recordType->getName();
         $o .= $code . ":" . $name . "\n";
         foreach ($recordType->getElementTypes() as $et) {
             $ec = $et->getCode();
             $o .= " - " . $ec;
             $o .= ":" . $et->getName();
             $e = $r->getElementByCode($ec);
             $value = $e->getValue();
             $value = str_replace(' ', '.', $value);
             $o .= "=`" . $value . "`\n";
         }
     }
     echo $o;
     exit;
 }
예제 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $parser = new CsvStandardParser();
     $filename = $input->getArgument('filename');
     $csvdata = file_get_contents($filename);
     $standard = $parser->parse($csvdata);
     print_r($standard);
 }