setDescription('BETA - Get assets count') ->addOption('type', null, InputOption::VALUE_REQUIRED, 'type of count assets report ') ->setHelp( "eg: bin/report count:assets --databox_id 2 --email 'admin@alchemy.fr' --dmin '2021-12-01' --dmax '2023-01-01' --type 'added,year,month' \n" . "\type of report\n" . "- 'added,year' number of added assets per year\n" . "- 'added,year,month' number of added assets per year, month\n" . "- 'downloaded,year' number of downloaded per year \n" . "- 'downloaded,year,month' number of downloaded per year, month \n" . "- 'downloaded,year,month,action' number of downloaded per year, month, action (direct download or by email) \n" . "- 'most-downloaded' The 10 most downloaded assets \n" ); } /** * @inheritDoc */ protected function getReport(InputInterface $input, OutputInterface $output) { $type = $input->getOption('type'); if (!empty($type) && !in_array($type, self::TYPES)) { $output->writeln("wrong '--type' option (--help for available value)"); return 1; } return new ReportCountAssets( $this->findDbOr404($this->sbasId), [ 'dmin' => $this->dmin, 'dmax' => $this->dmax, 'group' => $type ] ); } }