Render the error and warning summary.

@param array $withErrors
@param array $withWarnings
@param OutputInterface $output

@return int
762325
protected function renderSummary(
        array $withErrors,
        array $withWarnings,
        OutputInterface $output
    ) {
        $output->writeln("\n");

        if (count($withErrors)) {
            $output->writeln('<error>Errors:</error>');

            $this->renderErrors($withErrors, $output);
        }

        if (count($withWarnings)) {
            $output->writeln('<comment>Warning:</comment>');

            $this->renderWarnings($withWarnings, $output);
        }

        if (count($withErrors) === 0 && count($withWarnings) === 0) {
            $output->writeln('<success>GREAT JOB! IT\'S BEAUTIFUL</success>');

            return 0;
        } else {
            return 1;
        }
    }
14779
public function renderException($e, $output = null)
    {
        if ( ! $output) {
            $output = $this->output;

            if ($output instanceof ConsoleOutputInterface) {
                $output = $output->getErrorOutput();
            }
        }

        return parent::renderException($e, $output);
    }
691767
protected function showError($title, $messages = '', $output)
    {
        $output->writeln("<error>$title</error>");
        $output->writeln('');
        if (is_array($messages)) {
            foreach ($messages as $message) {
                $output->writeln("<comment>$message</comment>");
            }
            $output->writeln('');
        } elseif ($messages != '') {
            $output->writeln("<comment>$messages</comment>");
            $output->writeln('');
        }
    }
1217015
protected function processError($output, $exceptionOnError = true, $exceptionClass = ShellException::class)
    {
        if ($exceptionOnError && $this->hadError()) {
            $exceptionClass = $exceptionClass ?: ShellException::class;
            throw new $exceptionClass($output);
        }

        return $this;
    }
339817
protected function printErrors(): void
    {
        $this->output->writeln('');
        $this->output->writeln('');

        foreach ($this->errors as $error) {
            $this->output->write('<fg=red>ERROR   </> ' . $error['file'] . ':' . $error['line'] . ' - ');

            if ($error['type'] == 'class') {
                $this->output->write('Class <info>' . $error['class'] . '</info> is missing a docblock.');
            }

            if ($error['type'] == 'method') {
                $this->output->write('Method <info>' . $error['method'] . '</info> is missing a docblock.');
            }

            $this->output->writeln('');
        }
    }
665223
private function withError(ResponseInterface $response, $throwable)
    {
        $detail = 'Internal Server Error';
        $extensions = [];

        if ($this->displayErrorDetails) {
            $throwables = $this->unpackThrowables($throwable);
            $extensions['error_details'] = $this->formatStacktraceForExceptions($throwables);

            $detail = $throwable->getMessage();
        }

        $problem = new HTTPProblem(500, $detail, $extensions);
        return $this->renderProblem($response, $this->renderer, $problem);
    }
1215372
public function print(ValidationFailedException $e, OutputInterface $output) {

		$table = new Table($output);
		$table->setHeaders( ['Field', 'Problem'] );

		$i = 0;
		foreach( $e->getFailures() as $field => $messages ) {
			foreach($messages as $message)
				$table->setRow( $i++, [$field, $message] );

		}

		$table->render();
	}
1061132
private function printErrors(iterable $errors): void
    {
        $hasErrors = false;

        foreach ($errors as $error) {
            $hasErrors = true;

            /** @var ErrorInterface $error */
            $paramName  = $error->getParameterName();
            $entry      = empty($paramName) ? 'Validation' : "Param `$paramName`";
            $paramValue = $error->getParameterValue();
            $errorMsg   = $error->getMessageTemplate();
            $context    = $error->getMessageParameters();
            $errorMsg   = MessageFormatter::formatMessage('en', $errorMsg, $context !== null ? $context : []);

            $this->console("$entry failed for `$paramValue` with: $errorMsg" . PHP_EOL);
        }

        if ($hasErrors === false) {
            $this->console('No errors' . PHP_EOL);
        }
    }
1184342
public function renderErrors($errors)
    {
        if (empty($errors)) {
            return null;
        }

        $message = '';

        foreach ($errors as &$error) {
            foreach ($error as $errorCode => &$errorMsg) {
                $message .= $this->errorMapper($errorCode, $errorMsg);
            }
        }

        return $message;
    }
1002394
protected function printWarnings(): void
    {
        foreach ($this->warnings as $error) {
            $this->output->write('<fg=yellow>WARNING </> ');

            if ($error['type'] == 'param-missing') {
                $this->output->write('<info>' . $error['method'] . '</info> - @param <fg=cyan>' . $error['param'] . '</> missing.');
            }

            if ($error['type'] == 'param-mismatch') {
                $paramType = implode('|', (array)$error['param-type']);
                $this->output->write('<info>' . $error['method'] . '</info> - @param <fg=cyan>' . $error['param'] . '</> (' . $error['doc-type'] . ')  does not match method signature (' . $paramType . ').');
            }

            if ($error['type'] == 'return-missing') {
                $this->output->write('<info>' . $error['method'] . '</info> - @return missing.');
            }

            if ($error['type'] == 'return-mismatch') {
                $this->output->write('<info>' . $error['method'] . '</info> - @return <fg=cyan>' . $error['doc-type'] . '</>  does not match method signature (' . $error['return-type'] . ').');
            }

            $this->output->writeln('');
        }
    }
588442
public function errors($errors) {
        $html = '';
        foreach ($errors as $error) {
            $html .= $this->output->notification($error);
        }
        return $html;
    }
1271064
protected function formatOutput(OutputInterface $output, ConvertedResultIterator $fields_infos)
    {
        $output->writeln(sprintf("Relation <fg=cyan>%s.%s</fg=cyan>", $this->schema, $this->relation));
        $table = (new Table($output))
            ->setHeaders(['pk', 'name', 'type', 'default', 'notnull', 'comment'])
            ;

        foreach ($fields_infos as $info) {
            $table->addRow(
                [
                    $info['is_primary'] ? '<fg=cyan>*</fg=cyan>' : '',
                    sprintf("<fg=yellow>%s</fg=yellow>", $info['name']),
                    $this->formatType($info['type']),
                    $info['default'],
                    $info['is_notnull'] ? 'yes' : 'no',
                    wordwrap($info['comment']),
                ]
            );
        }

        $table->render();
    }
806200
protected function listReporters(OutputInterface $output)
    {
        $output->writeln("");
        foreach ($this->factory->getReporters() as $name => $info) {
            $output->writeln(sprintf("    %s - %s", $name, $info['description']));
        }
        $output->writeln("");
    }
43927
protected function returnValidationFailure(common_report_Report $report, $withMessage=true)
    {
        $data = ['data' => []];
        /** @var common_report_Report $error */
        foreach ($report->getErrors() as $error) {
            $data['data'][$error->getData()] = $error->getMessage();
        }

        if ($withMessage) {
            $data['success'] = false;
            $data['errorCode'] = 400;
            $data['errorMsg'] = 'Some fields are invalid';
            $data['version'] = TAO_VERSION;
        }

        $this->returnJson($data, 400);
        exit(0);
    }
609337
protected function logError()
  {
    $args   = func_get_args();
    $format = array_shift($args);

    foreach ($args as &$arg)
    {
      if (!is_scalar($arg)) $arg = var_export($arg, true);
    }

    if ($this->haltOnError) throw new \BuildException(vsprintf($format, $args));

    if (sizeof($args)==0)
    {
      $this->log($format, \Project::MSG_ERR);
    }
    else
    {
      $this->log(vsprintf($format, $args), \Project::MSG_ERR);
    }
  }
873351
public function withError($message, $errorCode, array $headers = [])
    {
        return $this->withArray([
                'error' => [
                    'code' => $errorCode,
                    'http_code' => $this->statusCode,
                    'message' => $message
                ]
            ],
            $headers
        );
    }
360334
protected function display(OutputInterface $output, array $rows = array(), array $failed = array())
    {
        $this->getApplication()->getHelperSet()->get('table')
            ->setHeaders(array('Name', 'Scripts', 'Rollbacks', 'Status'))
            ->setRows($rows)
            ->render($output);

        if (!empty($failed)) {
            $output->writeln(sprintf('<fg=red>Check failed for release(s) %s</fg=red>', implode(', ', $failed)));
        }
    }