option('limit'); $limit = is_numeric($limitOption) ? (int) $limitOption : null; $bar = null; $result = $service->import( (string) $this->option('base-url'), (bool) $this->option('dry-run'), $limit, function (int $processed, int $total, string $url, string $status) use (&$bar): void { if ($bar === null) { $bar = $this->output->createProgressBar($total); $bar->start(); } $bar->advance(); $bar->setMessage("{$status}: {$url}"); } ); if ($bar !== null) { $bar->finish(); $this->newLine(2); } $this->info('Helpdesk import finished.'); $this->table( ['Metric', 'Value'], [ ['Categories', $result['categories']], ['Sections', $result['sections']], ['Article URLs', $result['article_urls']], ['Imported', $result['imported']], ['Updated', $result['updated']], ['Skipped', $result['skipped']], ['Dry Run', $result['dry_run'] ? 'yes' : 'no'], ] ); return self::SUCCESS; } }