Пример #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $table = new Table($output);
     $table->setStyle('compact');
     $environment = $input->getArgument('environment');
     if (in_array($environment, array('dev', 'prod'))) {
         $loadedConfigurations = $this->loadConfigurations($environment);
     } else {
         $output->writeln(' <error>' . $this->trans('commands.site.mode.messages.invalid-env') . '</error>');
     }
     $configurationOverrideResult = $this->overrideConfigurations($loadedConfigurations['configurations']);
     foreach ($configurationOverrideResult as $configName => $result) {
         $output->writeln(sprintf(' <info>%s:</info> <comment>%s</comment>', $this->trans('commands.site.mode.messages.configuration'), $configName));
         $table->setHeaders([$this->trans('commands.site.mode.messages.configuration-key'), $this->trans('commands.site.mode.messages.original'), $this->trans('commands.site.mode.messages.updated')]);
         $table->setRows($result);
         $table->render();
         $output->writeln('');
     }
     $servicesOverrideResult = $this->overrideServices($loadedConfigurations['services'], $output);
     if (!empty($servicesOverrideResult)) {
         $output->writeln(' <info>' . $this->trans('commands.site.mode.messages.new-services-settings') . '</info>');
         $table->setHeaders([$this->trans('commands.site.mode.messages.service'), $this->trans('commands.site.mode.messages.service-parameter'), $this->trans('commands.site.mode.messages.service-value')]);
         $table->setStyle('compact');
         $table->setRows($servicesOverrideResult);
         $table->render();
     }
     $this->getChain()->addCommand('cache:rebuild', ['cache' => 'all']);
 }
Пример #2
0
 /**
  * @param Reciever[] $recievers
  */
 public function printRecievers(array $recievers)
 {
     $this->table->setHeaders(['name', 'email']);
     $rows = [];
     foreach ($recievers as $reciever) {
         $rows[] = [$reciever->getFullName(), $reciever->getEmail()];
     }
     $this->table->setRows($rows);
     $this->table->render();
     $this->table->setRows([]);
 }
Пример #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $job = $input->getArgument('job');
     $build = $input->getArgument('build') ? $input->getArgument('build') : 'lastBuild';
     $api = new Api();
     $res = $api->info($job, $build);
     $rows = [];
     $parameters = [];
     if (isset($res['actions'][0]['parameters']) && is_array($res['actions'][0]['parameters'])) {
         foreach ($res['actions'][0]['parameters'] as $parameter) {
             $parameters[] = implode('=', $parameter);
         }
         $rows[] = ['Parameters', implode("\n", $parameters)];
     }
     foreach ($res as $key => $value) {
         if (is_scalar($value) || is_null($value)) {
             $rows[] = [$key, $value];
         } else {
             $rows[] = [$key, substr(json_encode($value), 0, 100) . '...'];
         }
     }
     $table = new Table($output);
     $table->setRows($rows);
     $table->render();
 }
Пример #4
0
 /**
  * Execute the command.
  *
  * @param  \Symfony\Component\Console\Input\InputInterface  $input
  * @param  \Symfony\Component\Console\Output\OutputInterface  $output
  * @return void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $mod = new ModLib($input->getArgument('mod'));
     $table = new Table($output);
     $table->setRows(array(array('Mod Name', $mod->name), array('Mod Slug', $mod->slug), array('Mod Version', $mod->version), array('MC Version', $mod->mcversion)));
     $table->render();
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Allow special date param in the form of _1 for back one day, _2 for two
     // days etc.
     $date = $input->getArgument('date');
     if (preg_match('/_(\\d+)/', $date, $matches)) {
         $date = date('Y-m-d', time() - 86400 * $matches[1]);
     }
     $data = $this->repository->status($date);
     $table = new Table($output);
     $table->setHeaders(['Slot', 'JobId', 'Time', 'Title']);
     $rows = [];
     $total = 0;
     foreach ($data as $record) {
         $total += $record->duration;
         $details = $this->connector->ticketDetails($record->tid);
         if (!empty($record->active)) {
             $record->tid .= ' *';
         }
         $rows[] = [$record->id, $record->tid, Formatter::formatDuration($record->duration), $details->getTitle()];
     }
     $rows[] = new TableSeparator();
     $rows[] = ['', '<comment>Total</comment>', '<info>' . Formatter::formatDuration($total) . '</info>', ''];
     $table->setRows($rows);
     $table->render();
 }
Пример #6
0
 /**
  * Execute command
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return bool
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $quiet = $output->getVerbosity() == OutputInterface::VERBOSITY_QUIET;
     $verbose = $output->getVerbosity() == OutputInterface::VERBOSITY_VERBOSE;
     if (!$quiet) {
         $output->write('<info>' . $this->getApplication()->getName() . '</info>');
         $output->write(' version <comment>' . $this->getApplication()->getVersion() . '</comment> ');
         $output->writeln("by J.Ginés Hernández G. <*****@*****.**>\n");
     }
     $sourcePath = $input->getArgument('source');
     $destPath = $input->getArgument('dest');
     $formatType = $input->getOption('format');
     $sortImg = new PhotoSort($verbose);
     $items = $sortImg->copy($sourcePath, $destPath, $formatType);
     if ($verbose) {
         if (count($items)) {
             $table = new Table($output);
             $table->setHeaders(array('Old File', 'New File'));
             $table->setRows($items);
             $table->render();
         }
         $output->writeln("\nCheers!\n");
     }
     return true;
 }
Пример #7
0
    /**
     * Execute the console command.
     *
     * @return void
     */
    public function fire()
    {
        /** @var $plugin PluginBootstrap */
        \PluginManager::sync();
        if ($collection = \PluginManager::getPluginCollection() and count($collection) > 0) {
            /** @var Table $table */
            $table = new Table($this->getOutput());
            $table->setHeaders(['name', 'version', 'description', 'active', 'installed']);
            $rows = [];
            foreach ($collection as $plugin) {
                $rows[] = [$plugin->getName(), $plugin->getVersion(), $plugin->getDescription(), $plugin->isActive() ? 'yes' : 'no', $plugin->isInstalled() ? 'yes' : 'no'];
            }
            $table->setRows($rows);
            $table->render();
        } else {
            $line = <<<EVO
<info>no plugins avalaible</info>
EVO;
            $this->line($line);
        }
        /*$this->line(<<<EOF
        The <info>%command.name%</info> command lists all commands:
        
            <info>php %command.full_name%</info>
        
        You can also display the commands for a specific namespace:
        EOF
        );*/
        //$this->line('Alle Plugins.asdkjashdkash');
    }
Пример #8
0
 private function printTable(array $headers, array $rows, OutputInterface $output)
 {
     $table = new Table($output);
     $table->setHeaders($headers);
     $table->setRows($rows);
     $table->render();
 }
Пример #9
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $input->getArgument('config_file') ? $input->getArgument('config_file') : $this->configDefaultPath;
     $output->writeln('Linting <info>' . basename($path) . '</info>...');
     if (!is_file($path)) {
         throw new \InvalidArgumentException('"' . $path . '" is not a file.');
     } elseif (!is_readable($path)) {
         throw new \InvalidArgumentException('"' . $path . '" can not be read.');
     }
     $verifyLogFiles = $input->getOption('check-files');
     if ($verifyLogFiles) {
         $output->writeln('<comment>Also checking if the log files can be accessed.</comment>');
     }
     $output->writeln('');
     $lint = Config::lint(file_get_contents($path), $verifyLogFiles);
     $checkLines = [];
     foreach ($lint['checks'] as $check) {
         $checkLines = $this->prepareCheckLine($checkLines, $check);
     }
     $output->writeln('Checks:');
     $table = new Table($output);
     $table->setStyle('compact');
     $table->setRows($checkLines);
     $table->render();
     $output->writeln('');
     if ($lint['valid']) {
         $output->writeln('<fg=green>Your config file is valid.</>');
     } else {
         $output->writeln('<error> Your config file is not valid. </error>');
     }
 }
Пример #10
0
 /**
  * Executes the current command.
  *
  * This method is not abstract because you can use this class
  * as a concrete class. In this case, instead of defining the
  * execute() method, you set the code to execute by passing
  * a Closure to the setCode() method.
  *
  * @param InputInterface $input An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  *
  * @return null|int null or 0 if everything went fine, or an error code
  *
  * @throws \LogicException When this abstract method is not implemented
  *
  * @see setCode()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var DefinitionChecker $checker */
     $checker = $this->getContainer()->get('babymarkt_ext_cron.service.definitionchecker');
     $checker->setApplication($this->getApplication());
     /** @var Definition[] $definitions */
     $definitions = $this->getContainer()->getParameter('babymarkt_ext_cron.definitions');
     $errorFound = false;
     if (count($definitions)) {
         $resultList = [];
         foreach ($definitions as $alias => $definition) {
             $definition = new Definition($definition);
             if ($definition->isDisabled()) {
                 $resultList[] = ['alias' => $alias, 'command' => $definition->getCommand(), 'result' => '<comment>Disabled</comment>'];
             } else {
                 if (!$checker->check($definition)) {
                     $resultList[] = ['alias' => $alias, 'command' => $definition->getCommand(), 'result' => '<error>' . $checker->getResult() . '</error>'];
                     $errorFound = true;
                 } else {
                     $resultList[] = ['alias' => $alias, 'command' => $definition->getCommand(), 'result' => '<info>OK</info>'];
                 }
             }
         }
         $table = new Table($output);
         $table->setHeaders(['Alias', 'Command', 'Result']);
         $table->setRows($resultList);
         $table->render();
     } else {
         $output->writeln('<comment>No cron job definitions found.</comment>');
     }
     return (int) $errorFound;
 }
Пример #11
0
 /**
  * @param string          $path
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 protected function binaryInstallWindows($path, InputInterface $input, OutputInterface $output)
 {
     $php = Engine::factory();
     $table = new Table($output);
     $table->setRows([['<info>' . $php->getName() . ' Path</info>', $php->getPath()], ['<info>' . $php->getName() . ' Version</info>', $php->getVersion()], ['<info>Compiler</info>', $php->getCompiler()], ['<info>Architecture</info>', $php->getArchitecture()], ['<info>Thread safety</info>', $php->getZts() ? 'yes' : 'no'], ['<info>Extension dir</info>', $php->getExtensionDir()], ['<info>php.ini</info>', $php->getIniPath()]])->render();
     $inst = Install::factory($path);
     $progress = $this->getHelperSet()->get('progress');
     $inst->setProgress($progress);
     $inst->setInput($input);
     $inst->setOutput($output);
     $inst->install();
     $deps_handler = new Windows\DependencyLib($php);
     $deps_handler->setProgress($progress);
     $deps_handler->setInput($input);
     $deps_handler->setOutput($output);
     $helper = $this->getHelperSet()->get('question');
     $cb = function ($choices) use($helper, $input, $output) {
         $question = new ChoiceQuestion('Multiple choices found, please select the appropriate dependency package', $choices);
         $question->setMultiselect(false);
         return $helper->ask($input, $output, $question);
     };
     foreach ($inst->getExtDllPaths() as $dll) {
         if (!$deps_handler->resolveForBin($dll, $cb)) {
             throw new \Exception('Failed to resolve dependencies');
         }
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln("<comment>Watch out: only @Cache annotation and cache defined in routing are showned here.\nIf you set manually the cache via \$response->setPublic(true), it will appear here as private</comment>");
     $output->writeln("<comment>If so, you may want to use the @CacheMayBe annotation</comment>");
     $routes = $this->getContainer()->get('router')->getRouteCollection();
     $table = new Table($output);
     $table->setHeaders(['route + pattern', 'private', 'ttl']);
     $rows = [];
     $first = true;
     foreach ($routes as $route => $routeInfo) {
         $this->route = $route;
         $isPublic = $this->isRoutePublic($routeInfo);
         $hidePrivate = $input->getOption('only-public');
         $forcedRoute = $input->getArgument('route');
         $sameAsForcedRoute = $input->getArgument('route') === $route;
         if ($forcedRoute && $sameAsForcedRoute || !$forcedRoute && ($isPublic || !$hidePrivate)) {
             if ($first) {
                 $first = false;
             } else {
                 $rows[] = new TableSeparator();
             }
             $rows[] = ['<info>' . $route . "</info>\n" . $routeInfo->getPattern(), $this->routePublicText($routeInfo), $this->formatTtl($this->getTtl($routeInfo))];
         }
     }
     $table->setRows($rows);
     $table->render();
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Set filters & get data
     $type = $input->getArgument(self::TYPE_ARGUMENT);
     if ($type) {
         $this->productlist->setType($type);
     }
     $active = $input->getOption(self::ACTIVE_OPTION);
     if ($active) {
         $this->productlist->setStatus(1);
     }
     $products = $this->productlist->getProducts();
     // If only count, return it
     if ($input->getOption(self::COUNT_OPTION)) {
         return $output->writeln(sprintf('Count: %d', $products->getTotalCount()));
     }
     // Else prepare data for showing
     $types = $this->productlist->getProductTypesAssoc();
     $rows = new \ArrayObject();
     foreach ($products->getItems() as $id => $product) {
         $rows->append([$product->getId(), $product->getSku(), $product->getName(), $types[$product->getTypeId()]]);
     }
     // Output table layout
     $table = new Table($output);
     $table->setHeaders(['ID', 'SKU', 'Name', 'Type']);
     $table->setRows($rows->getArrayCopy());
     $table->render();
 }
Пример #14
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $source = $input->getArgument('source');
     if (is_dir($source) === false && is_file($source) === false) {
         throw new \InvalidArgumentException(sprintf('"%s" is not a file or a directory', $source));
     }
     $logger = new Logger($this->output, $input->getOption('debug'));
     if (is_dir($source) === true) {
         $collector = new DirectoryCodeCollector(array($source));
     } elseif (is_file($source) === true) {
         $collector = new FileCodeCollector(array($source));
     }
     foreach ($this->engine->convert($collector, $logger, $input->getArgument('file')) as $file) {
         $this->fileRender->render($file);
     }
     $table = new Table($this->output);
     $table->setHeaders(array(array(new TableCell('Incompatibility', array('colspan' => 4))), array('Type', 'Message', 'Line', 'Class')));
     $table->setRows($logger->getIncompatibility());
     $table->render();
     if ($input->getOption('v') === true) {
         $table = new Table($this->output);
         $table->setHeaders(array(array(new TableCell('Log', array('colspan' => 3))), array('Message', 'Line', 'Class')));
         $table->setRows($logger->getLogs());
         $table->render();
     }
 }
Пример #15
0
 /**
  * Execute the command
  *
  * @param InputInterface  $input  the user input
  * @param OutputInterface $output the command line output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $webfinger = new Net_WebFinger();
     // is http fallback enabled
     if ($input->getOption('insecure')) {
         $webfinger->fallbackToHttp = true;
     }
     $react = $webfinger->finger($input->getArgument("resource"));
     $output->writeln("<info>Data source URL: {$react->url}</info>");
     $output->writeln("<comment>Information secure: " . var_export($react->secure, true) . "</comment>");
     // check for errors
     if ($react->error !== null) {
         $this->displayError($react->error, $output);
         //return;
     }
     $helper = new \Lib\WebFingerHelper($react);
     // show profile
     $output->writeln("\n<info>Profile:</info>");
     $profile = $helper->getProfileTableView();
     $table = new Table($output);
     $table->setRows($profile);
     $table->setStyle('compact');
     $table->render();
     // show alternate identifier
     $output->writeln("\n<info>Alternate Identifier:</info>");
     foreach ($react->aliases as $alias) {
         $output->writeln(" * {$alias}");
     }
     // show links
     $output->writeln("\n<info>More Links:</info>");
     $links = $helper->getLinksTableView();
     $table = new Table($output);
     $table->setHeaders(array('Type', 'Link'))->setRows($links);
     $table->render();
 }
Пример #16
0
 /**
  * Execute the command.
  *
  * @param  \Symfony\Component\Console\Input\InputInterface  $input
  * @param  \Symfony\Component\Console\Output\OutputInterface  $output
  * @return void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $client = new Client();
     $modname = $input->getArgument('modname');
     $modversion = $input->getArgument('modversion');
     $config = solder_config();
     $response = $client->get($config->api);
     $server = $response->json();
     $response = $client->get($config->api . '/mod/' . $modname . '/' . $modversion);
     $json = $response->json();
     if (isset($json['error'])) {
         throw new \Exception($json['error']);
     }
     $rows = array();
     foreach ($json as $key => $value) {
         if ($key == 'versions') {
             $rows[] = array("<info>{$key}</info>", implode($value, "\n"));
         } else {
             $rows[] = array("<info>{$key}</info>", mb_strimwidth($value, 0, 80, "..."));
         }
     }
     $output->writeln('<comment>Server:</comment>');
     $output->writeln(" <info>{$server['api']}</info> version {$server['version']}");
     $output->writeln(" {$api}");
     $output->writeln('');
     $output->writeln("<comment>Mod:</comment>");
     $table = new Table($output);
     $table->setRows($rows)->setStyle('compact')->render();
 }
Пример #17
0
 /**
  * Execute the command.
  *
  * @param  InputInterface  $input
  * @param  OutputInterface  $output
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = $this->container['config'];
     $table = new Table($output);
     $table->setRows([['<b>Build status</b>'], [' Last build time', $this->formatLastBuildStatus()], [' Last source modified', $this->getSourceLastModifiedTime()->diffForHumans()], [''], ['<b>Sources</b>'], [' Directory', $this->formatDirectoryState($config['source.directory'])], [' Git repository', $this->getSourceRepo()], [''], ['<b>Builds</b>'], [' Output directory', $this->formatDirectoryState($config['build.directory'])], [' Pipeline', implode(" | ", $config['build.pipeline'])], [''], ['<b>Deployment</b>'], [' Pushes to', $this->getDeploymentRepo()], [''], ['<b>Gulp</b>'], [' Binary', $config['gulp.bin']], [' Gulpfile', $config['source.directory'] . DIRECTORY_SEPARATOR . $config['gulp.file']], [''], ['<b>Server</b>'], [' Relative URL', $config['serve.subdirectory']], [''], ['<b>Extensions</b>'], [' Bootstrap classes', $config['bootstrap'] ?: '(none)']]);
     $table->render();
 }
Пример #18
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var $logger LoggerInterface */
     $logger = $this->getContainer()->get('logger');
     $from = $input->getArgument('from');
     $to = $input->getArgument('to');
     $from = new \DateTime($from, new \DateTimeZone('UTC'));
     $to = new \DateTime($to, new \DateTimeZone('UTC'));
     $delete = $input->getOption('delete');
     $em = $this->getContainer()->get('ilioscore.auditlog.manager');
     $headers = $em->getFieldNames();
     $logger->info('Starting Audit Log Export.');
     $rows = $em->findInRange($from, $to);
     $logger->info(sprintf('Exporting %d audit log entries which were created between %s and %s.', count($rows), $from->format('c'), $to->format('c')));
     array_walk($rows, function (&$row) {
         /** @var \DateTime $dt */
         $dt = $row['createdAt'];
         $row['createdAt'] = $dt->format('c');
     });
     $table = new Table($output);
     $table->setHeaders($headers);
     $table->setRows($rows);
     $table->render();
     if ($delete) {
         $logger->info(sprintf('Deleting all audit log entries that were created between %s and %s.', $from->format('c'), $to->format('c')));
         $em->deleteInRange($from, $to);
     }
     $logger->info('Finished Audit Log Export.');
 }
Пример #19
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var $logger LoggerInterface */
     $logger = $this->getContainer()->get('logger');
     $from = $input->getArgument('from');
     $to = $input->getArgument('to');
     $from = new \DateTime($from, new \DateTimeZone('UTC'));
     $to = new \DateTime($to, new \DateTimeZone('UTC'));
     $delete = $input->getOption('delete');
     $em = $this->getContainer()->get('ilioscore.auditlog.manager');
     $headers = ['id', 'userId', 'action', 'createdAt', 'objectId', 'objectClass', 'valuesChanged'];
     $logger->info('Starting Audit Log Export.');
     $rows = array_map(function (array $arr) {
         /** @var \DateTime $dt */
         $dt = $arr['createdAt'];
         return [$arr['id'], $arr['userId'], $arr['action'], $dt->format('c'), $arr['objectId'], $arr['objectClass'], $arr['valuesChanged']];
     }, $em->findInRange($from, $to));
     $logger->info(sprintf('Exporting %d audit log entries which were created between %s and %s.', count($rows), $from->format('c'), $to->format('c')));
     $table = new Table($output);
     $table->setHeaders($headers);
     $table->setRows($rows);
     $table->render();
     if ($delete) {
         $logger->info(sprintf('Deleting all audit log entries that were created between %s and %s.', $from->format('c'), $to->format('c')));
         $em->deleteInRange($from, $to);
     }
     $logger->info('Finished Audit Log Export.');
 }
Пример #20
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->ensureExtensionLoaded('apc');
     $regexp = $input->getArgument('regexp');
     $user = $this->getCacheTool()->apc_cache_info('user');
     $keys = array();
     foreach ($user['cache_list'] as $key) {
         $string = $key['info'];
         if (preg_match('|' . $regexp . '|', $string)) {
             $keys[] = $key;
         }
     }
     $cpt = 0;
     $table = new Table($output);
     $table->setHeaders(array('Key', 'TTL'));
     $table->setRows($keys);
     $table->render($output);
     foreach ($keys as $key) {
         $success = $this->getCacheTool()->apc_delete($key['info']);
         if ($output->isVerbose()) {
             if ($success) {
                 $output->writeln("<comment>APC key <info>{$key['info']}</info> was deleted</comment>");
             } else {
                 $output->writeln("<comment>APC key <info>{$key['info']}</info> could not be deleted.</comment>");
             }
         }
         $cpt++;
     }
     if ($output->isVerbose()) {
         $output->writeln("<comment>APC key <info>{$cpt}</info> keys treated.</comment>");
     }
     return 1;
 }
Пример #21
0
 /**
  * Generates the output for the report.
  *
  * @param ConsoleLoggerInterface $logger
  */
 public function generate(ConsoleLoggerInterface $logger)
 {
     $logLevel = LogLevel::NOTICE;
     $style = TitleBlock::STYLE_SUCCESS;
     if ($this->eventDataCollector->hasCountedFailedEvents()) {
         $logLevel = LogLevel::ERROR;
         $style = TitleBlock::STYLE_FAILURE;
     } elseif ($this->eventDataCollector->hasCountedLogLevel(LogLevel::EMERGENCY) || $this->eventDataCollector->hasCountedLogLevel(LogLevel::ALERT) || $this->eventDataCollector->hasCountedLogLevel(LogLevel::CRITICAL) || $this->eventDataCollector->hasCountedLogLevel(LogLevel::ERROR) || $this->eventDataCollector->hasCountedLogLevel(LogLevel::WARNING)) {
         $logLevel = LogLevel::WARNING;
         $style = TitleBlock::STYLE_ERRORED_SUCCESS;
     }
     $output = $logger->getOutput($logLevel);
     $titleBlock = new TitleBlock($output, $this->messages[$style], $style);
     $titleBlock->render();
     $dataCollectorsData = array();
     foreach ($this->dataCollectors as $dataCollector) {
         $data = $dataCollector->getData($logger->getVerbosity());
         foreach ($data as $label => $value) {
             $dataCollectorsData[] = array($label, $value);
         }
     }
     $table = new Table($output);
     $table->setRows($dataCollectorsData);
     $table->setStyle('symfony-style-guide');
     $table->render();
     $output->writeln('');
 }
Пример #22
0
 /**
  * 转换report table到 table
  * @param ReportTable $reportTable
  * @return Table
  */
 protected function convertToTable(ReportTable $reportTable)
 {
     $output = $this->getMechanic()->getCommand()->getOutput();
     $table = new Table($output);
     $table->setHeaders($reportTable->getHeaders());
     $table->setRows($reportTable->getRows());
     return $table;
 }
Пример #23
0
 /**
  * @param OutputInterface $output
  * @param array           $rows headers are expected to be the keys of the first row.
  */
 public function render(OutputInterface $output, array $rows)
 {
     $table = new Table($output);
     $table->setStyle(new TableStyle());
     $table->setHeaders(array_keys($rows[0]));
     $table->setRows($rows);
     $table->render();
 }
Пример #24
0
 /**
  * Lista::execute()
  * 
  * ejecuta el proceso correspondiente de la
  * consola
  * 
  * @param object $input
  * @param object $output
  * @return raw
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln("\n\tLISTADO DE APLICACIONES REGISTRADAS\n\n");
     $tabla = new Table($output);
     $tabla->setHeaders(array('Nombre', 'Directorio', 'Creación'));
     $tabla->setRows($this->listado($input, $output));
     $tabla->render();
     $output->writeln("");
 }
Пример #25
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Find any untagged items needing review, use an arbitrarily early date.
     $review = $this->reviewer->getSummary(static::ALL, FALSE, $input->getOption('exact'));
     $table = new Table($output);
     $table->setHeaders(Reviewer::headers($input->getOption('exact')));
     $table->setRows($review);
     $table->render();
 }
Пример #26
0
 /**
  * Leverages the [Symfony Console Table helper](http://symfony.com/doc/current/components/console/helpers/table.html)
  * object to format results as a visual table.
  *
  * @param  Pimple|array    $data   The data to format.
  * @param  OutputInterface $output Symfony Console output.
  * @return void
  */
 public static function asTable($data, OutputInterface $output)
 {
     $table = new TableHelper($output);
     $table->setHeaders(['Key', 'Value']);
     $keys = self::parseData($data);
     $map = self::dataToMap($data, $keys);
     $table->setRows($map);
     $table->render();
 }
Пример #27
0
 /**
  * Lista::execute()
  * 
  * ejecuta el proceso correspondiente de la
  * consola
  * 
  * @param object $input
  * @param object $output
  * @return raw
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln("\n\tLISTADO DE CONEXIONES REGISTRADAS\n\n");
     $tabla = new Table($output);
     $tabla->setHeaders(array('Nombre', 'Entorno', 'Servidor', 'Driver'));
     $tabla->setRows($this->listado($input, $output));
     $tabla->render();
     $output->writeln("");
 }
Пример #28
0
 /**
  * @param Story[] $stories
  */
 private function renderStories(array $stories, OutputInterface $output)
 {
     $table = new Table($output);
     $table->setHeaders(['ID', 'Text', 'Creator', 'Owner', 'Comments', 'Status']);
     $table->setRows(array_map(function ($story) {
         $text = mb_substr(str_replace(["\n", "\t"], ['\\n', '\\t'], $story->text), 0, 40);
         return [$story->id, $text, $story->creator->email, $story->owner ? $story->owner->email : '', count($story->comments), $story->status];
     }, $stories));
     $table->render();
 }
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @throws \Exception
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $memcache = $this->getMemcachedInstance($input);
     $memcacheViewer = new MemcacheViewer($memcache);
     $filter = $input->getOption(self::OPTION_FILTER);
     $items = $memcacheViewer->find($filter, false);
     $table = new Table($output);
     $table->setHeaders(['Key', 'Value']);
     $table->setRows($items);
     $table->render();
 }
Пример #30
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $args = $input->getArgument('args');
     $trunks = $this->listTrunks();
     $trunkids = array();
     foreach ($trunks as $trunk) {
         $trunkids[$trunk['trunkid']] = $trunk['trunkid'];
     }
     if ($input->getOption('disable')) {
         $ARGUSED = True;
         $id = $input->getOption('disable');
         $output->writeln(_('Disabling Trunk ') . $id);
         $this->disableTrunk($id);
     }
     if ($input->getOption('enable')) {
         $ARGUSED = True;
         $id = $input->getOption('enable');
         $output->writeln(_('Enabling Trunk ') . $id);
         $this->enableTrunk($id);
     }
     if ($input->getOption('list')) {
         $ARGUSED = True;
         if ($input->getOption('json')) {
             $output->write(json_encode($trunks));
         } elseif ($input->getOption('xml')) {
             $xml = new \SimpleXMLElement('<trunks/>');
             array_walk_recursive($trunks, array($xml, 'addChild'));
             $output->write($xml->asXML());
         } else {
             $table = new Table($output);
             $table->setHeaders(array('ID', _('TECH'), _('Channel ID'), _('Disabled')));
             $table->setRows($trunks);
             $table->render();
         }
     }
     if (!$ARGUSED) {
         $table = new Table($output);
         $table->setHeaders(array('ID', _('TECH'), _('Channel ID'), _('Disabled')));
         $table->setRows($trunks);
         $output->writeln(_('Choose an ID to enable/disable'));
         $helper = $this->getHelper('question');
         $question = new ChoiceQuestion($table->render(), $trunkids, 0);
         $id = $helper->ask($input, $output, $question);
         if ($trunks[$id - 1]['disabled'] == 'off') {
             $output->writeln(_('Disabling Trunk ') . $id);
             $this->disableTrunk($id);
         }
         if ($trunks[$id - 1]['disabled'] == 'on') {
             $output->writeln(_('Enabling Trunk ') . $id);
             $this->enableTrunk($id);
         }
     }
 }