public static function printTokens(
        InputInterface $input,
        OutputInterface $output,
        array $tokens
    ) {
        $withMetadata = $input->getOption('with-metadata');
        $table = new Table($output);
        $headers = ['UUID', 'Indices', 'endpoints', 'plugins', 'ttl'];
        if ($withMetadata) {
            $headers[] = 'Metadata';
        }
        $table->setHeaders($headers);

        foreach ($tokens as $token) {
            $row = [
                $token->getTokenUUID()->composeUUID(),
                implode(', ', array_map(function (IndexUUID $index) {
                    return $index->composeUUID();
                }, $token->getIndices())),
                implode(', ', $token->getEndpoints()),
                implode(', ', $token->getPlugins()),
                $token->getTtl(),
            ];

            if ($withMetadata) {
                $metadataRow = [];
                foreach ($token->getMetadata() as $metadataField => $metadataValue) {
                    $metadataRow[] = sprintf("$metadataField = %s",
                        is_bool($metadataValue)
                            ? $metadataValue ? 'true' : 'false'
                            : (
                                is_array($metadataValue)
                                    ? implode(', ', $metadataValue)
                                    : (string) $metadataValue
                            )
                    );
                }
                $row[] = implode(PHP_EOL, $metadataRow);
            }

            $table->addRow($row);
        }

        $table->render();
    }