Processes the captured output.

The default implementation raises an {@link onProcessOutput} event.
If the event is not handled by any event handler, the output will be echoed.

@param string $output the captured output to be processed
15079
public function processOutput($output)
	{
		if($this->hasEventHandler('onProcessOutput'))
		{
			$event=new COutputEvent($this,$output);
			$this->onProcessOutput($event);
			if(!$event->handled)
				echo $output;
		}
		else
			echo $output;
	}
650932
protected function formatSuccess($result)
    {
        switch ($this->outputMode) {
            case self::MODE_SINGLE:
                $result->data = array_values($this->data)[0];
                break;

            case self::MODE_MULTIPLE:
                $result->data = array_values($this->data);
                break;

            case self::MODE_OTHER:
                // do nothing for this output mode
                break;

            default:
                throw new HTTPException('Error generating output.  Cannot match output mode with data set.', 500, [
                    'code' => '894684684646846816161'
                ]);
        }

        // process included records if there's valid entries only
        if ($this->data && $this->included) {
            $result->included = array_flatten($this->included);
        }
    }
1037563
public function terminate($output = null)
    {
        if ($output !== null) {
            echo $output;
        }
        $this->run_called = true; // prevent shutdown function from triggering.
        $this->callExit();
    }
214811
protected function ensureOutputIsBeingCaptured()
    {
        if (is_null($this->output) || $this->output == $this->getDefaultOutput()) {
            $this->sendOutputTo(storage_path('logs/schedule-'.sha1($this->mutexName()).'.log'));
        }
    }
1049964
public function setOutput($output)
    {
        $psrLogBase = self::PSR_LOG_BASE;
        $consoleBase = self::SYMFONY_CONSOLE_BASE;

        if (($output instanceof $psrLogBase) === false && ($output instanceof $consoleBase) === false) {
            $className = get_class($output);
            $message = 'Output class "%s" not supported. Only "%s" or "%s"';
            throw new \Exception(sprintf($message, $className, $psrLogBase, $consoleBase), 1369595109);
        }

        $this->output = $output;
    }
377657
public function doRun(InputInterface $input, OutputInterface $output)
    {
        $this->setOutput($output);

        $this->resetCodeBuffer();

        $this->setAutoExit(false);
        $this->setCatchExceptions(false);

        $this->readline->readHistory();

        $this->output->writeln($this->getHeader());
        $this->writeVersionInfo();
        $this->writeStartupMessage();

        try {
            $this->beforeRun();
            $this->loop->run($this);
            $this->afterRun();
        } catch (ThrowUpException $e) {
            throw $e->getPrevious();
        } catch (BreakException $e) {
            // The ProcessForker throws a BreakException to finish the main thread.
            return;
        }
    }
990721
protected function processReport($output)
    {
        $data = json_decode(trim($output), true);

        if (!is_array($data)) {
            $this->phpci->log($output);
            throw new \Exception(PHPCI\Helper\Lang::get('could_not_process_report'));
        }

        $errors = $data['totals']['errors'];
        $warnings = $data['totals']['warnings'];

        foreach ($data['files'] as $fileName => $file) {
            $fileName = str_replace($this->phpci->buildPath, '', $fileName);

            foreach ($file['messages'] as $message) {
                $this->build->reportError(
                    $this->phpci,
                    'php_code_sniffer',
                    'PHPCS: ' . $message['message'],
                    $message['type'] == 'ERROR' ? BuildError::SEVERITY_HIGH : BuildError::SEVERITY_LOW,
                    $fileName,
                    $message['line']
                );
            }
        }

        return array($errors, $warnings);
    }
873370
public function setHandler($output)
	{
		$this->_whoops->popHandler();

		if ($output == OutputData::Json)
		{
			$this->_handler = new JsonResponseHandler();
		}
		else if ($output == OutputData::Xml)
		{
			$this->_handler = new XmlResponseHandler();
		}
		else
		{
			$this->_handler = new PrettyPageHandler();
			if (!Context::getInstance()->getDevelopmentStatus())
			{
				$this->_handler->addResourcePath(\WhoopsResources\Resource::getPath());
			}
		}

		$this->_whoops->pushHandler($this->_handler);
	}
459494
public function run(Input $input, Output $output) {
        $this->input = $input;
        $this->output = $output;

        $this->getSynopsis(true);
        $this->getSynopsis(false);

        $this->mergeConsoleDefinition();

        try {
            $input->bind($this->definition);
        }
        catch (\Exception $e) {
            if (!$this->ignoreValidationErrors) {
                throw $e;
            }
        }

        $this->initialize($input, $output, $this);

        if ($input->isInteractive()) {
            $this->interact($input, $output, $this);
        }

        $input->validate();

        if ($this->code) {
            $statusCode = call_user_func($this->code, $input, $output);
        }
        else {
            $statusCode = $this->execute($input, $output, $this);
        }

        return is_numeric($statusCode) ? (int)$statusCode : 0;
    }
924386
public function innerCommand($output)
    {
        if ($this->output->isVeryVerbose()) {
            $this->write($output);
        }

        if (!$this->output->isVeryVerbose()) {
            $this->outputBuffer[] = $output;
        }
    }
516416
function appendOutput($output) {
		if ($this->finalOutput == '') {
			$this->finalOutput = $output;
		} else {
			$this->finalOutput .= $output;
		}
		
		return $this;
	}
355294
public function sendOutput(String $output, String $colour='white', String $backgroundColor='black')
	{
		fwrite(STDOUT, $this->getText($output, $colour, $backgroundColor));
	}
837792
protected void stageOutput(final String output) {
        boolean print = getPhaseConfiguration().isVerbose();
        if (print) {
            output(INDENT + INDENT + output);
        }
    }
294138
private function reportOnProcesses(InputInterface $input, OutputInterface $output)
    {
        $style = new SymfonyStyle($input, $output);

        $result = 0;
        foreach ($this->processes as $name => $process) {
            $style->newLine();

            echo $process->getOutput();

            if (!$process->isSuccessful()) {
                $result = 1;
                $style->error(sprintf('Command %s failed', $name));
            }
            $errorOutput = $process->getErrorOutput();
            if (!empty($errorOutput)) {
                $style->error(sprintf('Error output for %s command', $name));
                $style->writeln($errorOutput);
            }
        }

        return $result;
    }
231609
public function onInput($data)
    {
        //Process data here
        foreach ($this->params as $copy => $original) {
            $data[$copy] = $data[$original];
        }
        $this->next($data);
    }
548896
protected function readStream(&$stream, &$output) {
    $content = stream_get_contents($stream);
    if (strlen(rtrim($content))) {
      foreach (preg_split('/\r?\n/', $content) as $line) {
        $output[] = $line;
      }
    }
  }
722557
public function finalize()
    {
        /** @var Process $process */
        $process = $this->process;

        if ($process) {
            $process->wait();

            if ($process->isSuccessful()) {
                $this->successful = true;
                $this->output =  $process->getOutput();
            } else {
                $this->successful = false;
                $this->output =  $process->getErrorOutput();
            }

            $this->postRun();

            unset($this->process);
        }
    }