public function output() { if (empty($this->diff)) { return; } $formatter = new Formatter(); echo $formatter->format('--- ' . $this->beforeName, "strong_white"), "\n"; echo $formatter->format('+++ ' . $this->afterName, "strong_white"), "\n"; echo "@@ columns @@\n"; foreach ($this->diff as $d) { // for each diff items, show attribute diff switch ($d->flag) { case 'M': echo $formatter->format('M ' . $d->name, 'yellow'), "\n"; foreach ($d->details as $attrDiff) { echo "\t" . $formatter->format($attrDiff->getBeforeDescription(), 'red'); echo "\t" . $formatter->format($attrDiff->getAfterDescription(), 'green'); } break; case 'A': $line = $d->toColumnAttrsString(); echo $formatter->format($line . "\n", 'green'); break; case 'D': $line = $d->toColumnAttrsString(); echo $formatter->format($line . "\n", 'red'); break; } } }
public function __call($method, $args) { $msg = $args[0]; $indent = isset($args[1]) ? $args[1] : 0; $level = $this->getLevelByName($method); $style = $this->getStyleByName($method); if ($level > $this->level) { // do not print. return; } if ($this->level <= 4 && $level >= 4) { $style = 'dim'; } if ($this->indent) { $this->writer->write(str_repeat($this->indentCharacter, $this->indent)); } /* detect object */ if (is_object($msg) || is_array($msg)) { $this->writer->writeln($this->formatter->format(print_r($msg, 1), $style)); } else { $this->writer->writeln($this->formatter->format($msg, $style)); } }