/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $rows = []; $catalog = new Catalog(); $catalog->setRequest($this->request); $categoryCount = $catalog->categoryCount(); $rows[] = ['Categories', $categoryCount !== false ? $categoryCount : 'Unknown']; $productCount = $catalog->productCount(); $rows[] = ['Products', $productCount !== false ? $productCount : 'Unknown']; $this->out('Catalog Information', [['type' => 'table', 'data' => [['Type', 'Count'], $rows]]]); }
/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $this->writeHeader('Catalog Information'); $rows = array(); $catalog = new Catalog(); $catalog->setRequest($this->request); $categoryCount = $catalog->categoryCount($this->url); $rows[] = array('Categories', $categoryCount !== false ? $categoryCount : 'Unknown'); $productCount = $catalog->productCount($this->url); $rows[] = array('Products', $productCount !== false ? $productCount : 'Unknown'); $table = new Table($this->output); $table->setHeaders(array('Type', 'Count'))->setRows($rows)->render(); }
/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $rows = array(); $catalog = new Catalog(); $catalog->setRequest($this->request); $categoryCount = $catalog->categoryCount($this->url); $productCount = $catalog->productCount($this->url); if ($input->getOption('json')) { $return = ["Categories" => $categoryCount !== false ? $categoryCount : 'Unknown', "Prodcuts" => $productCount !== false ? $productCount : 'Unknown']; $output->write(json_encode($return)); } else { $rows = [['Categories', $categoryCount !== false ? $categoryCount : 'Unknown'], ['Products', $productCount !== false ? $productCount : 'Unknown']]; $this->writeHeader('Catalog Information'); $table = new Table($this->output); $table->setHeaders(array('Type', 'Count'))->setRows($rows)->render(); } }
/** * Check for catalog information * * @return void */ public function checkCatalog() { $rows = array(); $catalog = new Catalog(); $categoryCount = $catalog->categoryCount($this->url); $rows[] = array('<a href="' . $this->url . 'catalog/seo_sitemap/category" target="_blank">Categories</a>', $categoryCount !== false ? $categoryCount : 'Unknown'); $productCount = $catalog->productCount($this->url); $rows[] = array('<a href="' . $this->url . 'catalog/seo_sitemap/product" target="_blank">Products</a>', $productCount !== false ? $productCount : 'Unknown'); $this->respond(array('body' => $rows)); }
/** * Check for catalog information * * @return void */ public function checkCatalog() { $rows = []; $catalog = new Catalog(); $catalog->setRequest($this->request); $categoryCount = $catalog->categoryCount(); $rows[] = ['<a href="' . $this->url . 'catalog/seo_sitemap/category" target="_blank">Categories</a>', $categoryCount !== false ? $categoryCount : 'Unknown']; $productCount = $catalog->productCount(); $rows[] = ['<a href="' . $this->url . 'catalog/seo_sitemap/product" target="_blank">Products</a>', $productCount !== false ? $productCount : 'Unknown']; $this->respond(['body' => $rows]); }