Hypernode\Magento\Command\Hypernode\Log\ParseLogCommand::execute PHP Метод

execute() защищенный Метод

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->detectMagento($output);
        if (!$this->initMagento()) {
            return;
        }
        // this command will not run on windows.
        if (OperatingSystem::isWindows()) {
            $output->writeln('<error>This command is not compatible with windows.</error>');
            return;
        }
        $this->writeSection($output, 'Top log messages.');
        $logPath = $this->findLogPath($input->getOption('log'));
        if ($logPath) {
            $process = new Process("cut -d ' ' -f 2- " . $logPath . " | sort | uniq -c | sort -n -k 1 | tail -" . $input->getArgument('top') . "");
            $process->run(function ($type, $buffer) {
                if (Process::STATUS_READY) {
                    $this->_result = $buffer;
                }
            });
            $results = array_reverse(array_filter(explode("\n", $this->_result)));
            $i = 1;
            foreach ($results as $result) {
                $output->writeln('<comment>' . $i . '.</comment>' . " : " . $result);
                $i++;
            }
        } else {
            $output->writeln('<error>Could not find the path to the system.log</error>');
        }
    }