src/Expose/Console/Command/ProcessQueueCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $queueType = $input->getOption('queue-type');
        $notifyEmail = $input->getOption('notify-email');

        $manager = $this->getManager();

        if ($notifyEmail !== false) {
            $notify = new \Expose\Notify\Email();
            $notify->setToAddress($notifyEmail);
            $manager->setNotify($notify);
        }

        if ($queueType !== false) {
            $queueConnect = $input->getOption('queue-connect');
            if ($queueConnect === false) {
                $output->writeln('<error>Queue connection string not provided</error>');
                return;
            }
            // make the queue object with the right adapter
            $queueClass = '\\Expose\\Queue\\'.ucwords(strtolower($queueType));
            if (!class_exists($queueClass)) {
                $output->writeln('<error>Invalid queue type "'.$queueType.'"</error>');
                return;
            }
            $queue = new $queueClass();

            $adapter = $this->buildAdapter($queueType, $queueConnect, $queue->getDatabase());
            if ($adapter === false) {
                $output->writeln('<error>Invalid connection string</error>');
                return;
            }
            $queue->setAdapter($adapter);

        } else {
            $output->writeln('<error>Queue type not defined</error>');
            return;
        }
        $this->setQueue($queue);

        if ($input->getOption('list') !== false) {
            $output->writeln('<info>Current Queue Items Pending</info>');
            $this->listQueue($manager, $queue);
            return true;
        }

        // by default process the current queue
        $reports = $this->processQueue($output);
        if (count($reports) == 0) {
            return;
        }

        $exportFile = $input->getOption('export-file');
        if ($exportFile !== false) {
            $output->writeln('<info>Outputting results to file '.$exportFile.'</info>');
            file_put_contents(
                $exportFile,
                '['.date('m.d.Y H:i:s').'] '.json_encode($reports),
                FILE_APPEND
            );
        } else {
            echo json_encode($reports);
        }
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $queueType = $input->getOption('queue-type');
        $notifyEmail = $input->getOption('notify-email');

        $manager = $this->getManager();

        if ($notifyEmail !== false) {
            $notify = new \Expose\Notify\Email();
            $notify->setToAddress($notifyEmail);
            $manager->setNotify($notify);
        }

        if ($queueType !== false) {
            $queueConnect = $input->getOption('queue-connect');
            if ($queueConnect === false) {
                $output->writeln('<error>Queue connection string not provided</error>');
                return;
            }
            // make the queue object with the right adapter
            $queueClass = '\\Expose\\Queue\\'.ucwords(strtolower($queueType));
            if (!class_exists($queueClass)) {
                $output->writeln('<error>Invalid queue type "'.$queueType.'"</error>');
                return;
            }
            $queue = new $queueClass();

            $adapter = $this->buildAdapter($queueType, $queueConnect, $queue->getDatabase());
            if ($adapter === false) {
                $output->writeln('<error>Invalid connection string</error>');
                return;
            }
            $queue->setAdapter($adapter);

        } else {
            $output->writeln('<error>Queue type not defined</error>');
            return;
        }
        $this->setQueue($queue);

        if ($input->getOption('list') !== false) {
            $output->writeln('<info>Current Queue Items Pending</info>');
            $this->listQueue($manager, $queue);
            return true;
        }

        // by default process the current queue
        $reports = $this->processQueue($output);
        if (count($reports) == 0) {
            return;
        }

        $exportFile = $input->getOption('export-file');
        if ($exportFile !== false) {
            $output->writeln('<info>Outputting results to file '.$exportFile.'</info>');
            file_put_contents(
                $exportFile,
                '['.date('m.d.Y H:i:s').'] '.json_encode($reports),
                FILE_APPEND
            );
        } else {
            echo json_encode($reports);
        }
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ queueType = $ input -> getOption ( 'queue-type' ) ; $ notifyEmail = $ input -> getOption ( 'notify-email' ) ; $ manager = $ this -> getManager ( ) ; if ( $ notifyEmail !== false ) { $ notify = new \ Expose \ Notify \ Email ( ) ; $ notify -> setToAddress ( $ notifyEmail ) ; $ manager -> setNotify ( $ notify ) ; } if ( $ queueType !== false ) { $ queueConnect = $ input -> getOption ( 'queue-connect' ) ; if ( $ queueConnect === false ) { $ output -> writeln ( '<error>Queue connection string not provided</error>' ) ; return ; } // make the queue object with the right adapter $ queueClass = '\\Expose\\Queue\\' . ucwords ( strtolower ( $ queueType ) ) ; if ( ! class_exists ( $ queueClass ) ) { $ output -> writeln ( '<error>Invalid queue type "' . $ queueType . '"</error>' ) ; return ; } $ queue = new $ queueClass ( ) ; $ adapter = $ this -> buildAdapter ( $ queueType , $ queueConnect , $ queue -> getDatabase ( ) ) ; if ( $ adapter === false ) { $ output -> writeln ( '<error>Invalid connection string</error>' ) ; return ; } $ queue -> setAdapter ( $ adapter ) ; } else { $ output -> writeln ( '<error>Queue type not defined</error>' ) ; return ; } $ this -> setQueue ( $ queue ) ; if ( $ input -> getOption ( 'list' ) !== false ) { $ output -> writeln ( '<info>Current Queue Items Pending</info>' ) ; $ this -> listQueue ( $ manager , $ queue ) ; return true ; } // by default process the current queue $ reports = $ this -> processQueue ( $ output ) ; if ( count ( $ reports ) == 0 ) { return ; } $ exportFile = $ input -> getOption ( 'export-file' ) ; if ( $ exportFile !== false ) { $ output -> writeln ( '<info>Outputting results to file ' . $ exportFile . '</info>' ) ; file_put_contents ( $ exportFile , '[' . date ( 'm.d.Y H:i:s' ) . '] ' . json_encode ( $ reports ) , FILE_APPEND ) ; } else { echo json_encode ( $ reports ) ; } }
Execute the process-queue command

@param  InputInterface  $input  Input object
@param  OutputInterface $output Output object
@return null
Execute the process - queue command