Example #1
0
 public function formatToken(Token $token)
 {
     $attrs = array();
     $color = isset($this->colors[$token->getType()]) ? $this->colors[$token->getType()] : $this->colors[Token::TYPE_PLAIN_TEXT];
     $attrs['style'] = 'color: ' . $color;
     $description = $token->getDescription();
     if ($description) {
         $attrs['title'] = htmlentities($description);
     }
     return $this->formatTag($token->getValue(), $attrs);
 }
Example #2
0
 public function formatToken(Token $token)
 {
     if (!isset($this->colors[$token->getType()])) {
         return $token->getValue();
     }
     $colorName = $this->colors[$token->getType()];
     if (!isset(static::$availableForegroundColors[$colorName])) {
         return $token->getValue();
     }
     $colorCodes = static::$availableForegroundColors[$colorName];
     return sprintf("[%sm%s[%sm", $colorCodes['set'], $token->getValue(), $colorCodes['unset']);
 }
Example #3
0
 public function formatToken(Token $token)
 {
     return $token->getDescription() ?: $token->getValue();
 }