option('to') !== null ? Carbon::parse((string) $this->option('to')) : Carbon::now(); $from = $this->option('from') !== null ? Carbon::parse((string) $this->option('from')) : $to->copy()->subMonths(max(1, (int) $this->option('months'))); $data = $report->build($from, $to); if ($this->option('json')) { $this->line((string) json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); return self::SUCCESS; } $this->info("Konversionstrichter — {$data['from']} bis {$data['to']}"); if ($data['sources'] === []) { $this->newLine(); $this->warn('Keine Ereignisse im Zeitraum. Herkunftsdaten lassen sich nicht rückwirkend erzeugen — ' .'wenn hier dauerhaft nichts steht, greift eine Schreibstelle nicht.'); return self::SUCCESS; } foreach ($data['sources'] as $source) { $this->newLine(); $this->line("{$source['label']}"); $rows = []; foreach ($source['steps'] as $step) { $rows[] = [ $step['step'], $step['label'], $step['firmen'], $step['uebergang'] === null ? '–' : $step['uebergang'].' %', $step['ohne_firma'] > 0 ? $step['ohne_firma'] : '', $step['diagnosis'], ]; } $this->table( ['#', 'Stufe', 'Firmen', 'Übergang', 'ohne Firma', 'Ein Abbruch hier bedeutet'], $rows, ); } $this->newLine(); $this->line(' Gezählt werden eindeutige Firmen je Stufe — ein doppelter Klick ist kein doppelter Interessent.'); $this->line(' „ohne Firma" steht daneben statt darin: Diese Ereignisse gehören nicht in eine Quote, deren Nenner Firmen sind.'); return self::SUCCESS; } }