/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $techHeader = new TechHeader(); $techHeader->setRequest($this->request); $values = $techHeader->getHeaders($this->url); if (empty($values)) { if ($input->getOption('json')) { $this->output->write(json_encode(['error' => 'No detectable technology was found'])); } else { $this->output->writeln('No detectable technology was found'); } return; } if ($input->getOption('json')) { $this->output->write(json_encode($values)); } else { $rows = array(); foreach ($values as $key => $value) { $rows[] = array($key, $value); } $this->writeHeader('Server Technology'); $table = new Table($this->output); $table->setHeaders(array('Key', 'Value'))->setRows($rows)->render(); } }
/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $techHeader = new TechHeader(); $techHeader->setRequest($this->request); $values = $techHeader->getHeaders(); if (empty($values)) { return $this->out('Server Technology', 'No detectable technology was found'); } $rows = []; foreach ($values as $key => $value) { $rows[] = [$key, $value]; } $this->out('Server Technology', [['type' => 'table', 'data' => [['Key', 'Value'], $rows]]]); }
/** * Analize the server technology being used * * @return void */ protected function checkServerTech() { $this->writeHeader('Server Technology'); $techHeader = new TechHeader(); $techHeader->setRequest($this->request); $values = $techHeader->getHeaders($this->url); if (empty($values)) { $this->output->writeln('No detectable technology was found'); return; } $rows = array(); foreach ($values as $key => $value) { $rows[] = array($key, $value); } $table = new Table($this->output); $table->setHeaders(array('Key', 'Value'))->setRows($rows)->render(); }
/** * Check for server technologies * * @return void */ public function checkServertech() { $rows = []; $techHeader = new TechHeader(); $techHeader->setRequest($this->request); $values = $techHeader->getHeaders(); if (empty($values)) { $rows[] = ['No detectable technology was found']; } foreach ($values as $key => $value) { $rows[] = [$key, $value]; } $this->respond(['body' => $rows]); }