/** * @return ResultsRenderer */ protected function getRenderer() { $color = new Color(); $color->setForceStyle(true); $this->terminal = $this->createMock(TerminalInterface::class); $exerciseRepo = $this->createMock(ExerciseRepository::class); $this->terminal->expects($this->any())->method('getWidth')->will($this->returnValue(20)); $syntaxHighlighter = (new Factory())->__invoke(); return new ResultsRenderer('appName', $color, $this->terminal, $exerciseRepo, $syntaxHighlighter, new ResultRendererFactory()); }
/** * @param int $width * @return MenuStyle */ public function setWidth($width) { $availableWidth = $this->terminal->getWidth() - $this->margin * 2 - $this->padding * 2; if ($width >= $availableWidth) { $width = $availableWidth; } $this->width = $width; $this->calculateContentWidth(); return $this; }
/** * @return string */ public function lineBreak() { echo $this->color->__invoke(str_repeat('─', $this->terminal->getWidth()))->yellow(); }
/** * @throws InvalidTerminalException */ public function closeThis() { $this->terminal->clean(); $this->terminal->moveCursorToTop(); $this->open = false; }
/** * @return string */ public function lineBreak() { return $this->style(str_repeat("─", $this->terminal->getWidth()), 'yellow'); }
/** * Write some text at a particular column * * @param int $column * @param string $text */ protected function write($text, $column = null) { $this->terminal->moveCursorToColumn($column ?: $this->x); echo $text; }