/** * @param string $string * @param string $colour * * @return string */ public function colour($string, $colour) { try { return $this->color->__invoke($string)->apply($colour)->__toString(); } catch (NoStyleFoundException $e) { return $string; } }
/** * @return void */ public function __invoke() { $this->output->writeLine($this->color->__invoke('Usage')->yellow()->bold()); $this->output->writeLine(""); $this->output->writeLine(sprintf(" %s", $this->color->__invoke($this->appName)->green())); $this->output->writeLine(" Show a menu to interactively select a workshop."); $this->output->writeLine(sprintf(" %s print", $this->color->__invoke($this->appName)->green())); $this->output->writeLine(" Print the instructions for the currently selected workshop."); $this->output->writeLine(sprintf(" %s verify program.php", $this->color->__invoke($this->appName)->green())); $this->output->writeLine(" Verify your program against the expected output."); $this->output->writeLine(sprintf(" %s help", $this->color->__invoke($this->appName)->green())); $this->output->writeLine(" Show this help."); $this->output->writeLine(sprintf(" %s credits", $this->color->__invoke($this->appName)->green())); $this->output->writeLine(" Show the people who made this happen."); $this->output->writeLine(""); $this->output->writeLine($this->color->__invoke('Having trouble with a PHPSchool exercise?')->yellow()->bold()); $this->output->writeLine(""); $this->output->writeLine(" A team of expert helper elves is eagerly waiting to assist you in"); $this->output->writeLine(" mastering the basics of PHP, simply go to:"); $this->output->writeLine(" https://github.com/php-school/discussions"); $this->output->writeLine(" and add a New Issue and let us know what you're having trouble"); $this->output->writeLine(" with. There are no dumb questions!"); $this->output->writeLine(""); $this->output->writeLine(" If you're looking for general help with PHP, the #php"); $this->output->writeLine(" channel on Freenode IRC is usually a great place to find someone"); $this->output->writeLine(" willing to help. There is also the PHP StackOverflow Chat:"); $this->output->writeLine(" https://chat.stackoverflow.com/rooms/11/php"); $this->output->writeLine(""); $this->output->writeLine($this->color->__invoke('Found a bug with PHPSchool or just want to contribute?')->yellow()->bold()); $this->output->writeLine(" The official repository for PHPSchool is:"); $this->output->writeLine(" https://github.com/php-school/php-workshop"); $this->output->writeLine(" Feel free to file a bug report or (preferably) a pull request."); $this->output->writeLine(""); }
/** * @param string $string * @param array|string $colourOrStyle * * @return string * */ public function style($string, $colourOrStyle) { if (is_array($colourOrStyle)) { $this->color->__invoke($string); while ($style = array_shift($colourOrStyle)) { $this->color->apply($style); } return $this->color->__toString(); } return $this->color->__invoke($string)->apply($colourOrStyle, $string); }
/** * @return int|void */ public function __invoke() { if (empty($this->coreContributors)) { return; } $this->output->writeLine($this->color->__invoke("PHP School is bought to you by...")->yellow()->__toString()); $this->output->emptyLine(); $this->writeContributors($this->coreContributors); if (empty($this->appContributors)) { return; } $this->output->emptyLine(); $this->output->emptyLine(); $this->output->writeLine($this->color->__invoke("This workshop is brought to you by...")->yellow()->__toString()); $this->output->writeLine(""); $this->writeContributors($this->appContributors); }
/** * @return string */ public function lineBreak() { echo $this->color->__invoke(str_repeat('─', $this->terminal->getWidth()))->yellow(); }
/** * @param string $text * @param string $cmd * @return string */ private function helpLine($text, $cmd) { $cmd = $this->color->__invoke(sprintf('%s %s', $this->appName, $cmd))->yellow()->__toString(); return sprintf(" %s %s: %s\n", $this->color->__invoke("»")->bold()->__toString(), $text, $cmd); }