protected function test($count, $classes, OutputInterface $output)
 {
     $this->table = new Table($output);
     $this->table->setHeaders(array('Implementation', 'Memory', 'Duration'));
     $output->writeln(sprintf('<info>%d elements</info>', $count));
     $this->process = new ProgressBar($output, count($classes));
     $this->process->start();
     foreach ($classes as $class) {
         $shortClass = $class;
         //            if (in_array($class, $blacklist)) {
         //                $this->table->addRow([$class, '--', '--']);
         //                continue;
         //            };
         $path = __DIR__ . '/../../bin/test.php';
         $result = `php {$path} {$class} {$count}`;
         $data = json_decode($result, true);
         if (!$data) {
             echo $result;
         }
         $this->table->addRow([$shortClass, sprintf('%11sb', number_format($data['memory'])), sprintf('%6.4fs', $data['time'])]);
         $this->process->advance();
     }
     $this->process->finish();
     $output->writeln('');
     $this->table->render($output);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $templates = [];
     foreach ($this->defaults as $name => $defaults) {
         $templates[$name] = ['environments' => [], 'scalingProfiles' => []];
     }
     foreach ($this->environments as $template => $environments) {
         foreach ($environments as $name => $options) {
             $templates[$template]['environments'][] = $name;
         }
     }
     foreach ($this->scalingProfiles as $template => $scalingProfiles) {
         foreach ($scalingProfiles as $name => $options) {
             $templates[$template]['scalingProfiles'][] = $name;
         }
     }
     $table = new Table($output);
     $table->setHeaders(['Name', 'Environments', 'Scaling profiles']);
     $i = 0;
     foreach ($templates as $name => $data) {
         ++$i;
         $table->addRow([$name, implode("\n", $data['environments']), implode("\n", $data['scalingProfiles'])]);
         if ($i !== count($templates)) {
             $table->addRow(new TableSeparator());
         }
     }
     $table->render();
 }
 /**
  * {inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->setApi(new \AdministrationApi());
     $args = array();
     if ($modules = $input->getOption('modules')) {
         $args['module_list'] = $modules;
     }
     if ($searchOnly = $input->getOption('searchOnly')) {
         $args['search_only'] = true;
     }
     if ($byBoost = $input->getOption('byBoost')) {
         $args['order_by_boost'] = true;
     }
     $result = $this->callApi('searchFields', $args);
     // handle output which is different when ordered by boost
     $table = new Table($output);
     if ($byBoost) {
         $table->setHeaders(array('Module', 'Field', 'Boost'));
         foreach ($result as $raw => $boost) {
             $raw = explode('.', $raw);
             $table->addRow([$raw[0], $raw[1], $boost]);
         }
     } else {
         $table->setHeaders(array('Module', 'Field', 'Type', 'Searchable', 'Boost'));
         foreach ($result as $module => $fields) {
             foreach ($fields as $field => $props) {
                 $searchAble = !empty($props['searchable']) ? 'yes' : 'no';
                 $boost = isset($props['boost']) ? $props['boost'] : 'n/a';
                 $table->addRow([$module, $field, $props['type'], $searchAble, $boost]);
             }
         }
     }
     $table->render();
 }
Beispiel #4
0
 protected function _execute(InputInterface $input, OutputInterface $output)
 {
     $cnx = \jDb::getConnection('jacl2_profile');
     $table = new Table($output);
     $groupFiler = false;
     if ($input->getArgument('group')) {
         $id = $this->_getGrpId($input, true);
         $sql = "SELECT login FROM " . $cnx->prefixTable('jacl2_user_group') . " WHERE id_aclgrp =" . $cnx->quote($id);
         $table->setHeaders(array('Login'));
         $groupFiler = true;
     } else {
         $sql = "SELECT login, g.id_aclgrp, name FROM " . $cnx->prefixTable('jacl2_user_group') . " AS u " . " LEFT JOIN " . $cnx->prefixTable('jacl2_group') . " AS g\n                ON (u.id_aclgrp = g.id_aclgrp AND g.grouptype < 2)\n                ORDER BY login";
         $table->setHeaders(array('Login', 'group', 'group id'));
     }
     $cnx = \jDb::getConnection('jacl2_profile');
     $rs = $cnx->query($sql);
     foreach ($rs as $rec) {
         if ($groupFiler) {
             $table->addRow(array($rec->login));
         } else {
             $table->addRow(array($rec->login, $rec->name, $rec->id_aclgrp));
         }
     }
     $table->render();
 }
 /**
  * Write the given item.
  *
  * @param mixed $item
  */
 public function writeItem($item)
 {
     if ($this->autoDetectHeader && !$this->header) {
         $this->handleAutoDetectHeader($item);
     }
     $this->table->addRow($this->getValues($item, $this->getKeys($item)));
 }
 /**
  * This method will be called when the engine has finished the source analysis
  * phase.
  *
  * @param \PHPMD\Report $report
  */
 public function renderReport(Report $report)
 {
     $this->output->writeln('');
     $groupByFile = [];
     /** @var RuleViolation $violation */
     foreach ($report->getRuleViolations() as $violation) {
         $groupByFile[$violation->getFileName()][] = $violation;
     }
     /** @var ProcessingError $error */
     foreach ($report->getErrors() as $error) {
         $groupByFile[$error->getFile()][] = $error;
     }
     foreach ($groupByFile as $file => $problems) {
         $violationCount = 0;
         $errorCount = 0;
         $table = new Table($this->output);
         $table->setStyle('borderless');
         foreach ($problems as $problem) {
             if ($problem instanceof RuleViolation) {
                 $table->addRow([$problem->getBeginLine(), '<comment>VIOLATION</comment>', $problem->getDescription()]);
                 ++$violationCount;
             }
             if ($problem instanceof ProcessingError) {
                 $table->addRow(['-', '<error>ERROR</error>', $problem->getMessage()]);
                 ++$errorCount;
             }
         }
         $this->output->writeln([sprintf('<fg=white;options=bold>FILE: %s</>', str_replace($this->basePath . '/', '', $file)), sprintf('<fg=white;options=bold>FOUND %d ERRORS AND %d VIOLATIONS</>', $errorCount, $violationCount)]);
         $table->render();
         $this->output->writeln('');
     }
 }
 /**
  * instala arquivos do tema se tiver na extensao
  * @param $extension
  * @param $output
  */
 private function installThemeFiles($extension, $output)
 {
     $theme_files = Util::getFilesTheme($extension);
     if (count($theme_files)) {
         $table = new Table($output);
         $table->setHeaders(array('Theme Files'));
         $themes = Util::getThemesPath();
         foreach ($themes as $theme) {
             foreach ($theme_files as $theme_file) {
                 $dest = str_replace($extension . '/theme/', $theme . '/', $theme_file);
                 $dir = dirname($dest);
                 if (!is_dir($dir)) {
                     mkdir($dir, 0755, true);
                 }
                 if (!file_exists($dest)) {
                     $table->addRow(['<info>' . $dest . '</info>']);
                 } else {
                     $table->addRow(['<comment>' . $dest . '</comment>']);
                 }
                 @copy($theme_file, $dest);
             }
         }
         $table->render();
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $reader = new AnnotationReader();
     /** @var ManagerRegistry $doctrine */
     $doctrine = $this->getContainer()->get('doctrine');
     $em = $doctrine->getManager();
     $cmf = $em->getMetadataFactory();
     $existing = [];
     $created = [];
     /** @var ClassMetadata $metadata */
     foreach ($cmf->getAllMetadata() as $metadata) {
         $refl = $metadata->getReflectionClass();
         if ($refl === null) {
             $refl = new \ReflectionClass($metadata->getName());
         }
         if ($reader->getClassAnnotation($refl, 'Padam87\\AttributeBundle\\Annotation\\Entity') != null) {
             $schema = $em->getRepository('Padam87AttributeBundle:Schema')->findOneBy(['className' => $metadata->getName()]);
             if ($schema === null) {
                 $schema = new Schema();
                 $schema->setClassName($metadata->getName());
                 $em->persist($schema);
                 $em->flush($schema);
                 $created[] = $metadata->getName();
             } else {
                 $existing[] = $metadata->getName();
             }
         }
     }
     $table = new Table($output);
     $table->addRow(['Created:', implode(PHP_EOL, $created)]);
     $table->addRow(new TableSeparator());
     $table->addRow(['Existing:', implode(PHP_EOL, $existing)]);
     $table->render();
 }
Beispiel #9
0
 /**
  *
  * {@inheritDoc}
  *
  * @see \SK\ITCBundle\Service\Table\Adapter\IAdapter::write()
  */
 public function write(Table $table, OutputInterface $output)
 {
     $style = new TableStyle();
     $style->setHorizontalBorderChar('<fg=magenta>-</>')->setVerticalBorderChar('<fg=magenta>|</>')->setCrossingChar('<fg=magenta>+</>');
     $stable = new STable($output);
     $stable->setStyle('default');
     $stable->setHeaders($table->getHeaders());
     $columns = $table->getColumns();
     $colspan = count($columns);
     $rows = $table->getRows();
     foreach ($rows as $row) {
         $rowModificated = [];
         foreach ($columns as $iCol => $col) {
             if (is_int($iCol)) {
                 $iCol = $col;
             }
             if (array_key_exists($iCol, $row)) {
                 $rowModificated[$iCol] = wordwrap($row[$iCol], $table->getMaxColWidth(), "\n", true);
             } else {
                 $rowModificated[$iCol] = "";
             }
         }
         $stable->addRow($rowModificated);
         $stable->addRow(array(new TableSeparator(array('colspan' => $colspan))));
     }
     $stable->addRow(array(new TableCell("", array('colspan' => $colspan))));
     $stable->addRow(array(new TableCell(sprintf("Found %s results.", count($rows)), array('colspan' => $colspan))));
     $stable->render();
 }
Beispiel #10
0
 /**
  * Execute command
  *
  * @param  InputInterface  $input  Input instance
  * @param  OutputInterface $output Output instance
  *
  * @return int|null|void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->elevateProcess($input, $output);
     $procList = array();
     $openFilesTotal = 0;
     $command = new CommandBuilder('lsof', '-n');
     $command->addPipeCommand(new CommandBuilder('grep', '-oE \'^[a-z]+\''))->addPipeCommand(new CommandBuilder('sort'))->addPipeCommand(new CommandBuilder('uniq', '-c'))->addPipeCommand(new CommandBuilder('sort', '-n'))->setOutputRedirect(CommandBuilder::OUTPUT_REDIRECT_NO_STDERR);
     $execOutput = $command->execute()->getOutput();
     foreach ($execOutput as $execOutputLine) {
         // get open files and proc name from output
         list($procOpenFiles, $procName) = explode(' ', trim($execOutputLine), 2);
         // add to total stats
         $openFilesTotal += $procOpenFiles;
         $procList[] = array('name' => $procName, 'open_files' => $procOpenFiles);
     }
     // ########################
     // Output
     // ########################
     /** @var \Symfony\Component\Console\Helper\Table $table */
     $table = new Table($output);
     $table->setHeaders(array('Process', 'Open Files'));
     foreach ($procList as $procRow) {
         $procRow['open_files'] = FormatUtility::number($procRow['open_files']);
         $table->addRow(array_values($procRow));
     }
     // Stats: average
     $table->addRow(new TableSeparator());
     $statsRow = array();
     $statsRow['name'] = 'Total';
     $statsRow['open_files'] = FormatUtility::number($openFilesTotal);
     $table->addRow(array_values($statsRow));
     $table->render();
     return 0;
 }
Beispiel #11
0
 /**
  * @param OutputInterface $output
  * @param string          $action
  */
 protected function dumpProcessors(OutputInterface $output, $action)
 {
     /** @var ProcessorBagInterface $processorBag */
     $processorBag = $this->getContainer()->get('oro_api.processor_bag');
     $table = new Table($output);
     $table->setHeaders(['Processor', 'Attributes']);
     $context = new Context();
     $context->setAction($action);
     $processors = $processorBag->getProcessors($context);
     $processors->setApplicableChecker(new ChainApplicableChecker());
     $i = 0;
     foreach ($processors as $processor) {
         if ($i > 0) {
             $table->addRow(new TableSeparator());
         }
         $processorColumn = sprintf('<comment>%s</comment>%s%s', $processors->getProcessorId(), PHP_EOL, get_class($processor));
         $processorDescription = $this->getClassDocComment(get_class($processor));
         if (!empty($processorDescription)) {
             $processorColumn .= PHP_EOL . $processorDescription;
         }
         $attributesColumn = $this->formatProcessorAttributes($processors->getProcessorAttributes());
         $table->addRow([$processorColumn, $attributesColumn]);
         $i++;
     }
     $table->render();
 }
Beispiel #12
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $project = new Project(getcwd());
     if ($project->isValid()) {
         $book = $project->getBook($input->getArgument('name'), $input->getOption('locale'));
         if ($book instanceof Book) {
             $table = new Table($output);
             $table->setHeaders(['Property', 'Value']);
             $table->addRow(['Short Name', $book->getShortName()]);
             $table->addRow(['Title', $book->getTitle()]);
             $pages = $book->getPages();
             if ($pages->count() > 0) {
                 $page_titles = [];
                 foreach ($pages as $page) {
                     $page_titles[] = $page->getTitle();
                 }
                 $table->addRow(['Pages', implode("\n", $page_titles)]);
             } else {
                 $table->addRow(['Pages', '--']);
             }
             $table->render();
         } else {
             $output->writeln('<error>Book "' . $input->getArgument('name') . ' not found"</error>');
         }
     } else {
         $output->writeln('<error>This is not a valid Shade project</error>');
     }
 }
 /**
  *
  * TODO Provide extensibility to list of Sugar 7 boxes (allow hard coding, usage of a web service, etc.)
  * {inheritDoc}
  */
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $box = $input->getArgument('box');
     if (empty($box)) {
         $output->writeln('You MUST provide a <info>Vagrant Box Name</info> for your Sugar instance.');
         $output->writeln('<comment>You may pick one from below OR provide your own.</comment>');
         $table = new Table($output);
         $table->setHeaders(array('Box Name', 'PHP', 'Apache', 'MySQL', 'Elasticsearch', 'OS'));
         $table->addRow(['mmarum/sugar7-php54', '5.4.x', '2.2.x', '5.5.x', '1.4.x', 'Ubuntu 12.04']);
         $table->addRow(['mmarum/sugar7-php53', '5.3.x', '2.2.x', '5.5.x', '1.4.x', 'Ubuntu 12.04']);
         $table->render();
         $helper = $this->getHelper('question');
         $question = new Question('<info>Name of Vagrant Box?</info> <comment>[mmarum/sugar7-php54]</comment> ', 'mmarum/sugar7-php54');
         $question->setValidator(function ($answer) {
             if (empty($answer)) {
                 throw new \RuntimeException('You must provide a Box Name to continue!');
             }
             return $answer;
         });
         $question->setMaxAttempts(2);
         $box = $helper->ask($input, $output, $question);
         $input->setArgument('box', $box);
     }
     $output->writeln("<info>Using {$box} ...</info>");
 }
Beispiel #14
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         $source = $input->getArgument('source');
         if (!is_file($source) || !$this->isJpegImage($source)) {
             throw new \Exception(sprintf('Invalid jpeg file %s', $source));
         }
         $exif = exif_read_data($source);
         $formatter = $this->getHelper('formatter');
         $formattedLine = $formatter->formatSection('Exif data', $source);
         $output->writeln($formattedLine);
         $table = new Table($output);
         $table->setHeaders(array('Name', 'Value'));
         foreach ($exif as $clave => $sección) {
             if (is_array($sección)) {
                 foreach ($sección as $name => $value) {
                     $table->addRow(array($name, $value));
                 }
             } else {
                 $table->addRow(array($clave, $sección));
             }
         }
         $table->render();
     } catch (\Exception $e) {
         $output->writeln('<error>' . $e->getMessage() . '</error>');
         return 1;
     }
     return 0;
 }
Beispiel #15
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $jobId = $input->getArgument('job-id');
     $stats = $this->getBeanstalk()->statsJob($jobId);
     $output->writeln("<info>[Job ID: {$jobId}]</info>");
     $table = new Table($output);
     $table->setStyle('compact');
     $details = array_intersect_key($stats, array_flip(['tube', 'state']));
     foreach ($details as $detail => $value) {
         if ($detail == 'state' && $value == 'buried') {
             $value = "<error>{$value}</error>";
         }
         $table->addRow([$detail, $value]);
     }
     $table->render();
     $created = time();
     $table = new Table($output);
     $stats = array_diff_key($stats, array_flip(['id', 'tube', 'state']));
     $table->setHeaders(['Stat', 'Value']);
     foreach ($stats as $stat => $value) {
         if ($stat == 'age') {
             $created = time() - (int) $value;
             $dt = date('Y-m-d H:i:s', $created);
             $table->addRow(['created', $dt]);
         } elseif ($stat == 'delay') {
             $dt = date('Y-m-d H:i:s', $created + (int) $value);
             $table->addRow(['scheduled', $dt]);
         }
         $table->addRow([$stat, $value]);
     }
     $table->render();
 }
 /**
  * remove arquivos do tema
  * @param $extension
  * @param $output
  */
 private function removeThemeFiles($extension, $output)
 {
     $theme_files = Util::getFilesTheme($extension);
     if (count($theme_files)) {
         $table = new Table($output);
         $table->setHeaders(array('Theme Files'));
         $themes = Util::getThemesPath();
         foreach ($themes as $theme) {
             foreach ($theme_files as $theme_file) {
                 $dest = str_replace($extension . '/theme/', $theme . '/', $theme_file);
                 $dir = dirname($dest);
                 if (file_exists($dest)) {
                     $table->addRow(['<info>' . $dest . '</info>']);
                 } else {
                     $table->addRow(['<error>' . $dest . '</error>']);
                 }
                 @unlink($dest);
                 //limpa a pasta se estiver vazia
                 $dir_status = glob($dir . '/*');
                 if (empty($dir_status)) {
                     @rmdir($dir);
                 }
             }
         }
         $table->render();
     }
 }
Beispiel #17
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->table->setHeaders(['id', 'Title', 'Description']);
     foreach ($this->repository->getAll() as $exercise) {
         $this->table->addRow([$exercise->getId(), $exercise->getTitle(), $exercise->getDescription()]);
     }
     $this->table->render();
 }
 /**
  * {@inheritdoc}
  */
 public function writeItem(array $item)
 {
     // Save first item to get keys to display at header
     if (is_null($this->firstItem)) {
         $this->firstItem = $item;
     }
     $this->table->addRow($item);
 }
 protected function renderTable($limit, $offset = 0)
 {
     static $count;
     static $iterator;
     $options = ['query' => sanitize_string($this->option('keyword')), 'guids' => $this->option('guid') ?: ELGG_ENTITIES_ANY_VALUE, 'types' => $this->option('type') ?: 'object', 'subtypes' => $this->option('subtype') ?: ELGG_ENTITIES_ANY_VALUE, 'limit' => $limit, 'offset' => (int) $offset, 'order_by' => 'e.guid ASC'];
     if ($this->option('keyword')) {
         $results = elgg_trigger_plugin_hook('search', $this->option('type') ?: 'object', $options, []);
         $count = $results['count'];
         $batch = $results['entities'];
     } else {
         $options['count'] = true;
         if (!$count) {
             $count = elgg_get_entities($options);
         }
         unset($options['count']);
         $batch = new ElggBatch('elgg_get_entities', $options);
     }
     if (!$count) {
         $this->write('<comment>No entities to display</comment>');
         return;
     }
     $headers = ['#', 'GUID', 'Type', 'Title/name', 'Description', 'Owner', 'Container', 'Access'];
     if ($this->option('full-view')) {
         $headers[] = 'Metadata';
     }
     $table = new Table($this->output);
     $table->setHeaders($headers);
     foreach ($batch as $entity) {
         /* @var $entity \ElggEntity */
         $row = [$iterator, $entity->guid, ($subtype = $entity->getSubtype()) ? elgg_echo("item:{$entity->type}:{$subtype}") : elgg_echo("item:{$entity->type}"), elgg_get_excerpt($entity->getDisplayName(), 25), elgg_get_excerpt($entity->description, 25), ($owner = $entity->getOwnerEntity()) ? '[' . $owner->guid . '] ' . elgg_get_excerpt($owner->getDisplayName(), 25) : '', ($container = $entity->getContainerEntity()) ? '[' . $container->guid . '] ' . elgg_get_excerpt($container->getDisplayName(), 25) : '', '[' . $entity->access_id . '] ' . elgg_get_excerpt(get_readable_access_level($entity->access_id), 25)];
         if ($this->option('full-view')) {
             $metadata = new \ElggBatch('elgg_get_metadata', ['guids' => $entity->guid, 'limit' => 0]);
             $metatable = [];
             foreach ($metadata as $md) {
                 $name = $md->name;
                 $values = (array) $md->value;
                 foreach ($values as $value) {
                     $metatable[] = "{$name}: {$value}";
                 }
             }
             $row[] = implode("\n", $metatable);
         }
         $table->addRow($row);
         $table->addRow(new TableSeparator());
         $iterator++;
     }
     $table->render();
     if ($count > $limit + $offset) {
         $helper = $this->getHelper('question');
         $question = new ConfirmationQuestion('Load next batch [y,n]?', true);
         if (!$helper->ask($this->input, $this->output, $question)) {
             return;
         }
         $this->renderTable($limit, $limit + $offset);
     }
 }
 public function renderSuite(Suite $suite)
 {
     $table = new Table($this->output);
     $table->addRow([$suite->getName(), $suite->getDuration(), '']);
     $table->addRow(new TableSeparator());
     foreach ($suite->getTests() as $test) {
         $table->addRow([$test, $test->getDuration(), $this->getStatus($test)]);
     }
     return $table->render();
 }
Beispiel #21
0
 protected function renderConnection(array $config)
 {
     $this->output->writeln('<info>Connection</info>');
     $table = new Table($this->output);
     $table->addRow(['endpoint', $config['endpoint']]);
     $table->addRow(['token', $config['token']]);
     $table->addRow(new TableSeparator());
     $table->addRow(['ConnectionStatus', $this->connectionTest()]);
     $table->addRow(['Authorization', $this->authTest()]);
     $table->render();
 }
Beispiel #22
0
 /**
  * @param Container[] $containers
  */
 public function render(array $containers)
 {
     $table = new Table($this->output);
     $table->setHeaders(['Component', 'Container', 'DNS addresses', 'Port(s)', 'Status']);
     foreach ($containers as $index => $container) {
         if ($index > 0) {
             $table->addRow(new TableSeparator());
         }
         $table->addRow([$container->getComponentName(), $container->getName(), implode("\n", $container->getHosts()), implode("\n", $container->getPorts()), $this->getDecoratedState($container)]);
     }
     $table->render();
 }
 public function renderTable($output, $bookings)
 {
     $table = new Table($output);
     $table->setHeaders(array('Id', 'Date Start', 'Date End', 'Days', 'Room Type', 'Quantity', 'Total Price'));
     if (is_array($bookings)) {
         foreach ($bookings as $booking) {
             $table->addRow($this->getRow($booking));
         }
     } else {
         $table->addRow($this->getRow($bookings));
     }
     $table->render();
 }
Beispiel #24
0
 protected function doListOverview()
 {
     try {
         $overtime = $this->phprojekt->getPtimecontrolApi()->getOvertimeOverall();
         $vacationDays = $this->phprojekt->getPtimecontrolApi()->getVacationDays();
         $table = new Table(new ConsoleOutput());
         $table->addRow(['Overtime hours', Convert::text2hours($overtime)]);
         $table->addRow(['Vacation days', $vacationDays]);
         return $table->render();
     } catch (InvalidArgumentException $e) {
         $this->error('[Response] No information retrieved.');
     }
 }
Beispiel #25
0
 /**
  * {@inheritdoc}
  *
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $feed = \Feed::load($this->getFeedUrl());
     $output->writeln("<info>{$feed->title}</info>");
     $table = new Table($this->stdOut);
     $table->setHeaders(['Project', 'Version', 'Status', 'Title']);
     foreach ($feed->item as $item) {
         $descriptionDom = new \DOMDocument();
         $descriptionDom->loadHTML($item->description);
         $descriptionXpath = new \DOMXPath($descriptionDom);
         $table->addRow([$this->getIssueValue($descriptionXpath, 'field-name-field-project'), $this->getIssueValue($descriptionXpath, 'field-name-field-issue-version'), $this->getIssueStatus($descriptionXpath), $item->title . PHP_EOL . '<comment>' . $item->link . '</comment>']);
         $table->addRow(new TableSeparator());
     }
     $table->render();
 }
Beispiel #26
0
 protected function displayResultsTable(OutputInterface $output, $clean = false)
 {
     $table = new Table($output);
     $table->setHeaders(['Result', 'Check', 'Comment']);
     foreach ($this->messages as $message) {
         $row = $message;
         if (!$clean) {
             $row[0] = $this->textToEmoji($message[0]);
         }
         $table->addRow($row);
     }
     $table->addRow(new TableSeparator());
     $table->addRow([new TableCell($this->getResultText($clean), ['colspan' => 3])]);
     $table->render();
 }
 /**
  * {inheritdoc}
  *
  * Return codes:
  * 0 = queue is empty
  * 1 = queue is not empty
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->setApi(new \AdministrationApi());
     $result = $this->callApi('elasticSearchQueue', array());
     $table = new Table($output);
     $table->setHeaders(array('Module', 'Count'));
     if ($result['queued']) {
         foreach ($result['queued'] as $module => $count) {
             $table->addRow([$module, $count]);
         }
         $table->addRow(new TableSeparator());
     }
     $table->addRow(array('Total', $result['total']));
     $table->render();
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $groupPattern = $input->getArgument('group');
     if (empty($groupPattern)) {
         $groupPattern = '.*';
     }
     $cloudwatchLogsClient = \AwsInspector\SdkFactory::getClient('cloudwatchlogs');
     /* @var $cloudwatchLogsClient \Aws\CloudWatchLogs\CloudWatchLogsClient */
     $table = new Table($output);
     $table->setHeaders(['Name', 'Retention [days]', 'Size [MB]']);
     $totalBytes = 0;
     $nextToken = null;
     do {
         $params = ['limit' => 50];
         if ($nextToken) {
             $params['nextToken'] = $nextToken;
         }
         $result = $cloudwatchLogsClient->describeLogGroups($params);
         foreach ($result->get('logGroups') as $logGroup) {
             $name = $logGroup['logGroupName'];
             if (preg_match('/' . $groupPattern . '/', $name)) {
                 $table->addRow([$logGroup['logGroupName'], isset($logGroup['retentionInDays']) ? $logGroup['retentionInDays'] : 'Never', round($logGroup['storedBytes'] / (1024 * 1024))]);
                 $totalBytes += $logGroup['storedBytes'];
             }
         }
         $nextToken = $result->get("nextToken");
     } while ($nextToken);
     $table->render();
     $output->writeln('Total size: ' . $this->formatBytes($totalBytes));
 }
Beispiel #29
0
 private function FetchAllResults($collection, $output)
 {
     $table = new Table($output);
     $table->setHeaders(['Team', 'Opponent', 'Date', 'Result']);
     $collection->map(function ($item, $key) use($table) {
         if ($item->result->goalsHomeTeam > $item->result->goalsAwayTeam) {
             $table->addRow(['<bg=yellow;options=bold>' . $item->homeTeamName . '</>', $item->awayTeamName, Carbon::parse($item->date)->format('d/m/Y'), $item->result->goalsHomeTeam . ' : ' . $item->result->goalsAwayTeam]);
         } elseif ($item->result->goalsHomeTeam < $item->result->goalsAwayTeam) {
             $table->addRow([$item->homeTeamName, '<bg=yellow;options=bold>' . $item->awayTeamName . '</>', Carbon::parse($item->date)->format('d/m/Y'), $item->result->goalsHomeTeam . ' : ' . $item->result->goalsAwayTeam]);
         } else {
             $table->addRow([$item->homeTeamName, $item->awayTeamName, Carbon::parse($item->date)->format('d/m/Y'), $item->result->goalsHomeTeam . ' : ' . $item->result->goalsAwayTeam]);
         }
         //$output->writeln('<info>'. $item->homeTeamName .'</info>');
     });
     $table->render();
 }
 protected function execute(InputInterface $input, OutputInterface $output) : int
 {
     if (!$output->isQuiet()) {
         $output->writeln($this->getApplication()->getLongVersion());
     }
     $composerJson = $input->getArgument('composer-json');
     $this->checkJsonFile($composerJson);
     $getPackageSourceFiles = new LocateComposerPackageSourceFiles();
     $sourcesASTs = new LocateASTFromFiles((new ParserFactory())->create(ParserFactory::PREFER_PHP7));
     $definedVendorSymbols = (new LocateDefinedSymbolsFromASTRoots())->__invoke($sourcesASTs((new ComposeGenerators())->__invoke($getPackageSourceFiles($composerJson), (new LocateComposerPackageDirectDependenciesSourceFiles())->__invoke($composerJson))));
     $options = $this->getCheckOptions($input);
     $definedExtensionSymbols = (new LocateDefinedSymbolsFromExtensions())->__invoke((new DefinedExtensionsResolver())->__invoke($composerJson, $options->getPhpCoreExtensions()));
     $usedSymbols = (new LocateUsedSymbolsFromASTRoots())->__invoke($sourcesASTs($getPackageSourceFiles($composerJson)));
     $unknownSymbols = array_diff($usedSymbols, $definedVendorSymbols, $definedExtensionSymbols, $options->getSymbolWhitelist());
     if (!$unknownSymbols) {
         $output->writeln("There were no unknown symbols found.");
         return 0;
     }
     $output->writeln("The following unknown symbols were found:");
     $table = new Table($output);
     $table->setHeaders(['unknown symbol', 'guessed dependency']);
     $guesser = new DependencyGuesser();
     foreach ($unknownSymbols as $unknownSymbol) {
         $guessedDependencies = [];
         foreach ($guesser($unknownSymbol) as $guessedDependency) {
             $guessedDependencies[] = $guessedDependency;
         }
         $table->addRow([$unknownSymbol, implode("\n", $guessedDependencies)]);
     }
     $table->render();
     return (int) (bool) $unknownSymbols;
 }