Author: Michael Woodward (mikeymike.mw@gmail.com)
 /**
  * @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());
 }
Esempio n. 2
0
 /**
  * @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();
 }
Esempio n. 4
0
 /**
  * @throws InvalidTerminalException
  */
 public function closeThis()
 {
     $this->terminal->clean();
     $this->terminal->moveCursorToTop();
     $this->open = false;
 }
Esempio n. 5
0
 /**
  * @return string
  */
 public function lineBreak()
 {
     return $this->style(str_repeat("─", $this->terminal->getWidth()), 'yellow');
 }
Esempio n. 6
0
 /**
  * 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;
 }