Exemple #1
0
 /**
  * @inheritDoc
  */
 public function printContext(ContextInterface $context)
 {
     $this->output->writeln('');
     $this->output->writeln(sprintf('File: %s', $context->getCheckedResourceName()));
     foreach ($context->getMessages() as $message) {
         $nodes = $this->nodeStatementsRemover->removeInnerStatements($message->getNodes());
         $this->output->writeln(sprintf('Line %d. %s: %s', $message->getLine(), $message->getText(), $this->prettyPrinter->prettyPrint($nodes)));
     }
     $this->output->writeln('');
 }
Exemple #2
0
 /**
  * @param Message $message
  *
  * @return string
  */
 private function formatMessage(Message $message)
 {
     $nodes = $this->nodeStatementsRemover->removeInnerStatements($message->getNodes());
     $prettyPrintedNodes = str_replace("\n", "\n    ", $this->prettyPrinter->prettyPrint($nodes));
     $text = $message->getRawText();
     $color = self::$colors[$message->getLevel()];
     if ($color) {
         $text = sprintf('<fg=%s>%s</fg=%s>', $color, $text, $color);
     }
     return sprintf("> Line <fg=cyan>%s</fg=cyan>: %s\n    %s", $message->getLine(), $text, $prettyPrintedNodes);
 }
Exemple #3
0
 /**
  * {@inheritdoc}
  */
 public function printContext(ContextInterface $context)
 {
     $this->output->writeln('');
     $this->output->writeln(sprintf('File: <fg=cyan>%s</fg=cyan>', $context->getCheckedResourceName()));
     foreach ($context->getMessages() as $message) {
         $nodes = $this->nodeStatementsRemover->removeInnerStatements($message->getNodes());
         $this->output->writeln(sprintf("> Line <fg=cyan>%s</fg=cyan>: <fg=yellow>%s</fg=yellow>\n    %s", $message->getLine(), $message->getRawText(), str_replace("\n", "\n    ", $this->prettyPrinter->prettyPrint($nodes))));
     }
     foreach ($context->getErrors() as $error) {
         $this->output->writeln(sprintf('> <fg=red>%s</fg=red>', $error->getText()));
     }
     $this->output->writeln('');
 }