Command/QueryCommand.php
public static function makeQueryAndPrintResults(
        InputInterface $input,
        OutputInterface $output,
        callable $makeQuery
    ) {
        $query = $input->getArgument('query');

        self::printInfoMessage(
            $output,
            'Query / Page / Size',
            sprintf('<strong>%s</strong> / %d / %d',
                '' === $query
                    ? '*'
                    : $query,
                $input->getOption('page'),
                $input->getOption('size')
            )
        );

        try {
            $result = $makeQuery(Query::create(
                $input->getArgument('query'),
                (int) $input->getOption('page'),
                (int) $input->getOption('size')
            ));

            self::printResult($output, $result);
        } catch (ResourceNotAvailableException $exception) {
            self::printInfoMessage(
                $output,
                self::getHeader(),
                $output->writeln('Index not found. Skipping.')
            );
        }
    }
public static function makeQueryAndPrintResults(
        InputInterface $input,
        OutputInterface $output,
        callable $makeQuery
    ) {
        $query = $input->getArgument('query');

        self::printInfoMessage(
            $output,
            'Query / Page / Size',
            sprintf('<strong>%s</strong> / %d / %d',
                '' === $query
                    ? '*'
                    : $query,
                $input->getOption('page'),
                $input->getOption('size')
            )
        );

        try {
            $result = $makeQuery(Query::create(
                $input->getArgument('query'),
                (int) $input->getOption('page'),
                (int) $input->getOption('size')
            ));

            self::printResult($output, $result);
        } catch (ResourceNotAvailableException $exception) {
            self::printInfoMessage(
                $output,
                self::getHeader(),
                $output->writeln('Index not found. Skipping.')
            );
        }
    }
public static function makeQueryAndPrintResults ( InputInterface $ input , OutputInterface $ output , callable $ makeQuery ) { $ query = $ input -> getArgument ( 'query' ) ; self :: printInfoMessage ( $ output , 'Query / Page / Size' , sprintf ( '<strong>%s</strong> / %d / %d' , '' === $ query ? '*' : $ query , $ input -> getOption ( 'page' ) , $ input -> getOption ( 'size' ) ) ) ; try { $ result = $ makeQuery ( Query :: create ( $ input -> getArgument ( 'query' ) , ( int ) $ input -> getOption ( 'page' ) , ( int ) $ input -> getOption ( 'size' ) ) ) ; self :: printResult ( $ output , $ result ) ; } catch ( ResourceNotAvailableException $ exception ) { self :: printInfoMessage ( $ output , self :: getHeader ( ) , $ output -> writeln ( 'Index not found. Skipping.' ) ) ; } }
Make query and print results.

@param InputInterface  $input
@param OutputInterface $output
@param callable        $makeQuery
Make query and print results .