Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas CHERIFI committed Apr 10, 2016
1 parent 2039aa8 commit 3c48466
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Command/ParserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ protected function configure()
->setName('pdf-parser:parse')
->setDescription('Parse document of many types.')
->addArgument('processor', InputArgument::OPTIONAL, 'The id of the processor')
->addArgument('filepath', InputArgument::OPTIONAL, 'The absolute path to the PDF file to parse.')
->addArgument('file_path', InputArgument::OPTIONAL, 'The absolute path to the PDF file to parse.')
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (console, json, yml)', 'console');
}

/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -53,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$pdfParser->setProcessor($processors[$processorId]);

// Select file
$filePath = $input->getArgument('filepath');
$filePath = $input->getArgument('file_path');
if (!$filePath) {
$helper = $this->getHelper('question');
$finder = new Finder();
Expand Down
6 changes: 3 additions & 3 deletions PdfParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private function doParse($data)

$endPos = ParseHelper::findPosition($data, $this->processorConfiguration['endConditions']);
if (is_null($endPos)) {
throw new Exception('End condition not reached at the ' . (count($blocks) + 1) . 'nth loop of block.');
throw new Exception('End condition not reached at the ' . (count($blocks) + 1) . ' nth loop of block.');
} else {
$blockData = substr($data, 0, $endPos);
$data = substr($data, $endPos);
Expand All @@ -132,7 +132,7 @@ private function doParse($data)
$blocks[] = $block;
}

// MERGE BLOCKS
// Merge block.
$data = [];
foreach ($blocks as $block) {
$data = array_merge($data, $block);
Expand Down Expand Up @@ -217,7 +217,7 @@ private function findSpaceGroups($rawRows)
}
}

// clean "false positive" space groups
// Clean "false positive" space groups.
$spaceGroups = array_filter($spaceGroups, function ($spaceGroup) {
return $spaceGroup['end'] - $spaceGroup['start'] > 1;
});
Expand Down

0 comments on commit 3c48466

Please sign in to comment.