mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-04 13:16:31 +00:00
Various code cleanup.
This commit is contained in:
@@ -76,10 +76,10 @@ class ConfigureRolesHandler implements FileConfigurationInterface
|
||||
if (\in_array($role, ['amount', 'amount_credit', 'amount_debit'])) {
|
||||
$hasAmount = true;
|
||||
}
|
||||
if ($role === 'foreign-currency-code') {
|
||||
if ('foreign-currency-code' === $role) {
|
||||
$hasForeignCode = true;
|
||||
}
|
||||
if ($role === 'amount_foreign') {
|
||||
if ('amount_foreign' === $role) {
|
||||
$hasForeignAmount = true;
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ class ConfigureRolesHandler implements FileConfigurationInterface
|
||||
$count = $config['column-count'];
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$role = $data['role'][$i] ?? '_ignore';
|
||||
$mapping = (isset($data['map'][$i]) && $data['map'][$i] === '1');
|
||||
$mapping = (isset($data['map'][$i]) && '1' === $data['map'][$i]);
|
||||
$config['column-roles'][$i] = $role;
|
||||
$config['column-do-mapping'][$i] = $mapping;
|
||||
Log::debug(sprintf('Column %d has been given role %s (mapping: %s)', $i, $role, var_export($mapping, true)));
|
||||
@@ -130,7 +130,7 @@ class ConfigureRolesHandler implements FileConfigurationInterface
|
||||
$config = $this->ignoreUnmappableColumns($config);
|
||||
$messages = $this->configurationComplete($config);
|
||||
|
||||
if ($messages->count() === 0) {
|
||||
if (0 === $messages->count()) {
|
||||
$this->repository->setStage($this->importJob, 'ready_to_run');
|
||||
if ($this->isMappingNecessary($config)) {
|
||||
$this->repository->setStage($this->importJob, 'map');
|
||||
@@ -175,7 +175,7 @@ class ConfigureRolesHandler implements FileConfigurationInterface
|
||||
public function getExamplesFromFile(Reader $reader, array $config): void
|
||||
{
|
||||
$limit = (int)config('csv.example_rows', 5);
|
||||
$offset = isset($config['has-headers']) && $config['has-headers'] === true ? 1 : 0;
|
||||
$offset = isset($config['has-headers']) && true === $config['has-headers'] ? 1 : 0;
|
||||
|
||||
// make statement.
|
||||
try {
|
||||
@@ -214,7 +214,7 @@ class ConfigureRolesHandler implements FileConfigurationInterface
|
||||
public function getHeaders(Reader $reader, array $config): array
|
||||
{
|
||||
$headers = [];
|
||||
if (isset($config['has-headers']) && $config['has-headers'] === true) {
|
||||
if (isset($config['has-headers']) && true === $config['has-headers']) {
|
||||
try {
|
||||
$stmt = (new Statement)->limit(1)->offset(0);
|
||||
$records = $stmt->process($reader);
|
||||
@@ -273,7 +273,7 @@ class ConfigureRolesHandler 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user