Rename some variables.

This commit is contained in:
James Cole
2018-05-10 23:11:11 +02:00
parent 6f984aa591
commit 50874c9cf7
2 changed files with 16 additions and 15 deletions

View File

@@ -180,10 +180,12 @@ class ConfigureMappingHandler implements ConfigurationInterface
// in order to actually map we also need to read the FULL file. // in order to actually map we also need to read the FULL file.
try { try {
$reader = $this->getReader(); $reader = $this->getReader();
// @codeCoverageIgnoreStart
} catch (Exception $e) { } catch (Exception $e) {
Log::error($e->getMessage()); Log::error($e->getMessage());
throw new FireflyException('Cannot get reader: ' . $e->getMessage()); throw new FireflyException('Cannot get reader: ' . $e->getMessage());
} }
// @codeCoverageIgnoreEnd
// get ALL values for the mappable columns from the CSV file: // get ALL values for the mappable columns from the CSV file:
$columnConfig = $this->getValuesForMapping($reader, $config, $columnConfig); $columnConfig = $this->getValuesForMapping($reader, $config, $columnConfig);

View File

@@ -180,21 +180,20 @@ class ConfigureRolesHandler implements ConfigurationInterface
} }
return new MessageBag; return new MessageBag;
} }
/** /**
* Extracts example data from a single row and store it in the class. * Extracts example data from a single row and store it in the class.
* *
* @param array $row * @param array $line
*/ */
private function getExampleFromRow(array $row): void private function getExampleFromLine(array $line): void
{ {
foreach ($row as $index => $value) { foreach ($line as $column => $value) {
$value = trim($value); $value = trim($value);
if (\strlen($value) > 0) { if (\strlen($value) > 0) {
$this->examples[$index][] = $value; $this->examples[$column][] = $value;
} }
} }
} }
@@ -223,13 +222,13 @@ class ConfigureRolesHandler implements ConfigurationInterface
// grab the records: // grab the records:
$records = $stmt->process($reader); $records = $stmt->process($reader);
/** @var array $row */ /** @var array $line */
foreach ($records as $row) { foreach ($records as $line) {
$row = array_values($row); $line = array_values($line);
$row = $this->processSpecifics($row); $line = $this->processSpecifics($line);
$count = \count($row); $count = \count($line);
$this->totalColumns = $count > $this->totalColumns ? $count : $this->totalColumns; $this->totalColumns = $count > $this->totalColumns ? $count : $this->totalColumns;
$this->getExampleFromRow($row); $this->getExampleFromLine($line);
} }
// save column count: // save column count:
$this->saveColumCount(); $this->saveColumCount();
@@ -361,11 +360,11 @@ class ConfigureRolesHandler implements ConfigurationInterface
/** /**
* if the user has configured specific fixes to be applied, they must be applied to the example data as well. * if the user has configured specific fixes to be applied, they must be applied to the example data as well.
* *
* @param array $row * @param array $line
* *
* @return array * @return array
*/ */
private function processSpecifics(array $row): array private function processSpecifics(array $line): array
{ {
$config = $this->importJob->configuration; $config = $this->importJob->configuration;
$specifics = $config['specifics'] ?? []; $specifics = $config['specifics'] ?? [];
@@ -373,10 +372,10 @@ class ConfigureRolesHandler implements ConfigurationInterface
foreach ($names as $name) { foreach ($names as $name) {
/** @var SpecificInterface $specific */ /** @var SpecificInterface $specific */
$specific = app('FireflyIII\Import\Specifics\\' . $name); $specific = app('FireflyIII\Import\Specifics\\' . $name);
$row = $specific->run($row); $line = $specific->run($line);
} }
return $row; return $line;
} }