Table example

$io = new ShopwareStyle($input$output);

        if ($missingSnippetsCollection->count() === 0) {
            $io->success('Snippets are valid!');

            return self::SUCCESS;
        }

        if (!$input->getOption('fix')) {
            $io->error('Invalid snippets found!');
            $table = new Table($output);
            $table->setHeaders([
                'Snippet', 'Missing for ISO', 'Found in file',
            ]);

            foreach ($missingSnippetsCollection->getIterator() as $missingSnippetStruct) {
                $table->addRow([
                    $missingSnippetStruct->getKeyPath(),
                    $missingSnippetStruct->getMissingForISO(),
                    $missingSnippetStruct->getFilePath(),
                ]);
            }

            
/** @var ProductFeed $productFeed */
        foreach ($productFeeds as $productFeed) {
            $rows[] = [
                $productFeed->getName(),
                $productFeed->getId(),
                $productFeed->getLastExport()->format('Y-m-d H:i:s'),
                $this->formatInterval($productFeed->getInterval()),
                $productFeed->getActive() ? 'Yes' : 'No',
            ];
        }

        $table = new Table($output);
        $table->setHeaders(['Product Feed', 'Id', 'Last export', 'Interval', 'Active'])
            ->setRows($rows);

        $table->render();

        return 0;
    }

    private function formatInterval($interval)
    {
        switch ($interval) {
            


        $encoded = json_encode($json, \JSON_THROW_ON_ERROR);

        $output->write($encoded);

        return self::SUCCESS;
    }

    private function renderTable(OutputInterface $output, array $headers, array $data): int
    {
        $table = new Table($output);
        $table->setHeaders($headers);

        // Normalize data         foreach ($data as $rowKey => $row) {
            foreach ($row as $columnKey => $column) {
                if (\is_array($column)) {
                    $data[$rowKey][$columnKey] = implode(', ', $column);
                }
            }
        }

        

    public function __construct(private readonly TaskRegistry $taskRegistry)
    {
        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $entities = $this->taskRegistry->getAllTasks(Context::createDefaultContext());

        $table = new Table($output);
        $table->setHeaders(['Name', 'Next execution', 'Last execution', 'Run interval', 'Status']);

        /** @var ScheduledTaskEntity $entity */
        foreach ($entities as $entity) {
            $table->addRow([
                $entity->getName(),
                $entity->getNextExecutionTime()->format(\DATE_ATOM),
                $entity->getLastExecutionTime() ? $entity->getLastExecutionTime()->format(\DATE_ATOM) : '-',
                $entity->getRunInterval(),
                $entity->getStatus(),
            ]);
        }
$progressBar->advance();
            }
        }
    }

    /** * @param OptimizerInterface[] $capabilities */
    private function displayCapabilities(OutputInterface $output, array $capabilities)
    {
        $table = new Table($output);
        $table->setHeaders(['Optimizer', 'Runnable', 'Supported mime-types']);
        foreach ($capabilities as $optimizer) {
            $table->addRow([
                $optimizer->getName(),
                $optimizer->isRunnable() ? 'Yes' : 'No',
                implode(', ', $optimizer->getSupportedMimeTypes()),
            ]);
        }
        $table->render();
    }

    
$this->migrateFilesIn('media', $fromFilesystem$toFileSystem$progressBar);
        $progressBar->finish();

        $rows = [];
        foreach ($this->counter as $key => $value) {
            $rows[] = [$key$value];
        }

        $output->writeln('');
        $output->writeln('');

        $table = new Table($output);
        $table->setStyle('borderless');
        $table->setHeaders(['Action', 'Number of items']);
        $table->setRows($rows);
        $table->render();
    }

    /** * Migrate a single file * * @param string $path * * @throws RuntimeException */
foreach ($listing->getPlugins() as $plugin) {
            $result[] = [
                'id' => $plugin->getId(),
                'technicalName' => $plugin->getTechnicalName(),
                'label' => $plugin->getLabel(),
                'installed' => ($plugin->getInstallationDate() !== null),
                'version' => $plugin->getVersion(),
                'updateAvailable' => $plugin->isUpdateAvailable(),
            ];
        }

        $table = new Table($output);
        $table->setHeaders(['Id', 'Technical name', 'Label', 'Installed', 'Version', 'Update available'])
            ->setRows($result);

        $table->render();

        return 0;
    }
}

                }
            }

            $io->listing($messages);

            return self::SUCCESS;
        }

        $io->text('Access tokens:');

        $table = new Table($output);
        $table->setHeaders(['Key', 'Value']);

        $table->addRows([
            ['Access key', $accessKey],
        ]);

        $table->render();

        return self::SUCCESS;
    }

    
$tableData = [];

        foreach ($categories as $category) {
            $tableData[] = [
                $category->getId(),
                $category->getName(),
                $this->getCategoryPath($category),
            ];
        }

        $table = new Table($this->output);
        $table
            ->setHeaders(['Id', 'Name', 'Path'])
            ->setRows($tableData);
        $table->render();
    }

    /** * Creates a human readable category path * * @return string */
    

    protected function configure(): void
    {
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        if (!$this->client->ping()) {
            throw new \RuntimeException('Elasticsearch server is not accessible');
        }

        $table = new Table($output);
        $table->setHeaders(['Name', 'Status']);
        $health = $this->client->cluster()->health();

        $table->addRow(['Cluster Status', $health['status']]);
        $table->addRow(['Available Nodes', $health['number_of_nodes']]);

        $indexTask = $this->connection->fetchAssociative('SELECT * FROM elasticsearch_index_task WHERE entity = "product" LIMIT 1');
        $totalProducts = (int) $this->connection->fetchOne('SELECT COUNT(*) FROM product WHERE version_id = :liveVersionId AND child_count = 0 OR parent_id IS NOT NULL', ['liveVersionId' => Uuid::fromHexToBytes(Defaults::LIVE_VERSION)]);

        // No entry in key         if ($indexTask === false) {
            
foreach ($plugins as $plugin) {
            $rows[] = [
                $plugin->getName(),
                $plugin->getLabel(),
                $plugin->getVersion(),
                $plugin->getAuthor(),
                $plugin->getActive() ? 'Yes' : 'No',
                $plugin->getInstalled() ? 'Yes' : 'No',
            ];
        }

        $table = new Table($output);
        $table->setHeaders(['Plugin', 'Label', 'Version', 'Author', 'Active', 'Installed'])
              ->setRows($rows);

        $table->render();

        return 0;
    }
}
/** @var LicenceStruct $licence */
        foreach ($licences as $licence) {
            $result[] = [
                'technicalName' => $licence->getTechnicalName(),
                'label' => $licence->getLabel(),
                'domain' => $licence->getShop(),
                'createDate' => $licence->getCreationDate()->format('Y-m-d'),
                'type' => $licence->getPriceModel()->getType(),
            ];
        }

        $table = new Table($output);
        $table->setHeaders(['Technical name', 'Description', 'domain', 'Creation date', 'Type'])
              ->setRows($result);

        $table->render();

        return 0;
    }
}
->getShops($token);

        $domains = [];

        foreach ($shops as $shop) {
            $domains[] = [
               $shop['domain'],
               number_format($shop['balance'], 2),
            ];
        }

        $table = new Table($output);
        $table->setHeaders(['Domain', 'Balance'])
              ->setRows($domains);

        $table->render();

        return 0;
    }
}
$client = $this->container->get(Client::class);
        $index = $this->container->get(IndexFactory::class)->createShopIndex($shop$type);

        $analyzed = $client->indices()->analyze([
            'index' => $index->getName(),
            'analyzer' => $analyzer,
            'text' => $query,
        ]);

        $tokens = $analyzed['tokens'];

        $table = new Table($output);
        $table->setHeaders(['Token', 'Start', 'End', 'Type', 'position'])
            ->setRows($tokens)
            ->render();

        return 0;
    }
}
foreach ($manager->getAllJobs() as $job) {
            $rows[] = [
                $job->getName(),
                $job->getAction(),
                $job->getActive() ? 'Yes' : 'No',
                $job->getInterval(),
                $job->getNext(),
                $job->getEnd(),
            ];
        }

        $table = new Table($output);
        $table->setHeaders(['Name', 'Action', 'Active', 'Interval', 'Next run', 'Last run'])
              ->setRows($rows);

        $table->render();

        return 0;
    }
}
Home | Imprint | This part of the site doesn't use cookies.