Example #1
0
 /**
  * @param $addable
  * @param $removable
  * @return string
  */
 public function getTitle($addable, $removable)
 {
     $title = 'Are you sure you want to perform these updates?' . PHP_EOL;
     if (!empty($addable)) {
         $title .= PHP_EOL . 'Install:';
         foreach ($addable as $package) {
             $title .= PHP_EOL . ' ' . unicode_to_string('\\u2714') . '  ' . $package;
         }
     }
     if (!empty($removable)) {
         $title .= PHP_EOL . 'Remove:';
         foreach ($removable as $package) {
             $title .= PHP_EOL . ' ' . unicode_to_string('\\u2716') . '  ' . $package;
         }
     }
     return $title;
 }
Example #2
0
 /**
  * Returns an array of styled options
  *
  * @param  $choices
  * @param  $position
  * @param  $selected
  * @return array
  */
 public function getFormattedChoices(array $choices, $position, $selected)
 {
     $lines = [];
     foreach ($choices as $index => $choice) {
         $state = in_array($choice, $selected) ? self::CHOICE_SELECTED : self::CHOICE_NORMAL;
         $cursor = $index === $position ? self::CHOICE_HOVERED : self::CHOICE_NORMAL;
         // select which style to use
         $line = $this->style[$state][$cursor];
         // add the fancy fish eye symbol to make things prettier
         $choice = '  ' . unicode_to_string('\\u25C9') . '  ' . $choice;
         $lines[] = sprintf($line, $this->fitText($this->window->getWidth(), $choice));
     }
     return $lines;
 }
Example #3
0
 /**
  * Get the encoded escape key
  *
  * @return string
  */
 public function getEscapeKey()
 {
     return unicode_to_string($this->escape);
 }