mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Some issues fixed for scrutiniser.
This commit is contained in:
@@ -416,17 +416,24 @@ class ImportController extends Controller
|
||||
* @param ImportJob $job
|
||||
*
|
||||
* @return SetupInterface
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function makeImporter(ImportJob $job): SetupInterface
|
||||
{
|
||||
// create proper importer (depends on job)
|
||||
$type = $job->file_type;
|
||||
$type = strtolower($job->file_type);
|
||||
|
||||
/** @var SetupInterface $importer */
|
||||
$importer = app('FireflyIII\Import\Setup\\' . ucfirst($type) . 'Setup');
|
||||
$importer->setJob($job);
|
||||
// validate type:
|
||||
$validTypes = array_keys('firefly.import_formats');
|
||||
|
||||
return $importer;
|
||||
if (in_array($type, $validTypes)) {
|
||||
/** @var SetupInterface $importer */
|
||||
$importer = app('FireflyIII\Import\Setup\\' . ucfirst($type) . 'Setup');
|
||||
$importer->setJob($job);
|
||||
|
||||
return $importer;
|
||||
}
|
||||
throw new FireflyException(sprintf('"%s" is not a valid file type', $type));
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user