Code clean up

This commit is contained in:
James Cole
2017-06-24 13:04:41 +02:00
parent 8a175d147b
commit 04a8a0e6a1
17 changed files with 29 additions and 398 deletions

View File

@@ -87,13 +87,8 @@ class Import extends Command
$this->error(sprintf('Error importing line #%d: %s', $index, $error));
}
// display result to user:
//$this->presentResults($result);
$this->line(sprintf('The import has finished. %d transactions have been imported out of %d records.', $routine->journals->count(), $routine->lines));
// get any errors from the importer:
//$this->presentErrors($job);
return;
}
@@ -120,36 +115,4 @@ class Import extends Command
return true;
}
/**
* @param ImportJob $job
*/
private function presentErrors(ImportJob $job)
{
$extendedStatus = $job->extended_status;
if (isset($extendedStatus['errors']) && count($extendedStatus['errors']) > 0) {
$this->line(sprintf('The following %d error(s) occured during the import:', count($extendedStatus['errors'])));
foreach ($extendedStatus['errors'] as $error) {
$this->error($error);
}
}
}
/**
* @param Collection $result
*/
private function presentResults(Collection $result)
{
/**
* @var int $index
* @var TransactionJournal $journal
*/
foreach ($result as $index => $journal) {
if (!is_null($journal->id)) {
$this->line(sprintf('Line #%d has been imported as transaction #%d.', $index, $journal->id));
continue;
}
$this->error(sprintf('Could not store line #%d', $index));
}
}
}