Various code cleanup.

This commit is contained in:
James Cole
2018-07-27 05:03:37 +02:00
parent 0312ba8ad7
commit e3e0e12fef
43 changed files with 167 additions and 145 deletions

View File

@@ -183,7 +183,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
{
$canBeMapped = config('csv.import_roles.' . $name . '.mappable');
return $canBeMapped === true && $requested === true;
return true === $canBeMapped && true === $requested;
}
/**
@@ -247,7 +247,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
$collection = $this->repository->getAttachments($this->importJob);
/** @var Attachment $attachment */
foreach ($collection as $attachment) {
if ($attachment->filename === 'import_file') {
if ('import_file' === $attachment->filename) {
$content = $this->attachments->getAttachmentContent($attachment);
break;
}
@@ -274,7 +274,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
*/
public function getValuesForMapping(Reader $reader, array $config, array $columnConfig): array
{
$offset = isset($config['has-headers']) && $config['has-headers'] === true ? 1 : 0;
$offset = isset($config['has-headers']) && true === $config['has-headers'] ? 1 : 0;
try {
$stmt = (new Statement)->offset($offset);
// @codeCoverageIgnoreStart
@@ -295,7 +295,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
continue;
}
$value = trim($line[$columnIndex]);
if (\strlen($value) === 0) {
if ('' === $value) {
// value is empty, ignore it.
continue;
}
@@ -309,7 +309,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
$columnConfig[$columnIndex]['values'] = array_unique($columnConfig[$columnIndex]['values']);
asort($columnConfig[$columnIndex]['values']);
// if the count of this array is zero, there is nothing to map.
if (\count($columnConfig[$columnIndex]['values']) === 0) {
if (0 === \count($columnConfig[$columnIndex]['values'])) {
unset($columnConfig[$columnIndex]);
}
}