get('filename'); $importerClass = Importer::class; switch ($this->get('import-type')) { case "asset": $importerClass = 'App\Importer\AssetImporter'; break; case "accessory": $importerClass = 'App\Importer\AccessoryImporter'; break; case "component": die("This is not implemented yet"); $importerClass = ComponentImporter::class; break; case "consumable": $importerClass = 'App\Importer\ConsumableImporter'; break; } $importer = new $importerClass( $filename, [$this, 'log'], [$this, 'progress'], [$this, 'errorCallback'], false, /*testrun*/ Auth::id(), $this->has('import-update'), 'firstname.lastname' ); $importer->import(); return $this->errors; } public function log($string) { return; // FUTURE IMPLEMENTATION } public function progress($count) { // Open for future return; } public function errorCallback($item, $field, $errorString) { $this->errors[$item->name][$field] = $errorString; } private $errors; }