option('folder'); if (! is_string($folderOption) || trim($folderOption) === '') { $this->error('Folder path must not be empty'); return self::FAILURE; } $folder = rtrim($folderOption, '/\\'); if (! File::isDirectory($folder)) { $this->error('Folder path does not exist: '.$folder); return self::FAILURE; } try { $manifestPaths = $manifests->findManifests($folder); } catch (Throwable $exception) { $this->error($exception->getMessage()); return self::FAILURE; } $imported = $skipped = $failed = 0; foreach ($manifestPaths as $manifestPath) { $result = $importer->importManifest( $manifestPath, (bool) $this->option('delete'), (bool) $this->option('delete-failed'), ); match ($result['status']) { 'imported' => $imported++, 'failed' => $failed++, default => $skipped++, }; if ($result['status'] === 'failed') { $this->warn(basename(dirname($manifestPath)).': '.$result['message']); } } $this->info("Processed {$imported} NFOs, skipped {$skipped}, failed {$failed}."); return $failed === 0 ? self::SUCCESS : self::FAILURE; } }