當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Style::setColor方法代碼示例

本文整理匯總了PHP中Style::setColor方法的典型用法代碼示例。如果您正苦於以下問題:PHP Style::setColor方法的具體用法?PHP Style::setColor怎麽用?PHP Style::setColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Style的用法示例。


在下文中一共展示了Style::setColor方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: parseString

 protected function parseString()
 {
     while ($this->lexer->moveNext()) {
         if (in_array($this->lexer->lookahead, $this->lookaheadToSkip)) {
             continue;
         }
         $value = $this->lexer->lookahead['value'];
         switch ($this->lexer->lookahead['type']) {
             case Lexer::T_NONE:
                 $this->none($value);
                 break;
             case Lexer::T_ESCAPED_CHAR:
                 $this->escapedCharacter($value);
                 break;
             case Lexer::T_COLOR:
                 $color = preg_replace('/([^0-9a-f])/iu', '0', $value);
                 $this->currentStyle->setColor($color);
                 $this->color();
                 break;
             case Lexer::T_NO_COLOR:
                 if ($this->stylesStack) {
                     $color = $this->stylesStack[count($this->stylesStack) - 1]->getColor();
                 } else {
                     $color = null;
                 }
                 $this->currentStyle->setColor($color);
                 $this->color();
                 break;
             case Lexer::T_SHADOWED:
                 $this->currentStyle->setShadowed(!$this->currentStyle->isShadowed());
                 $this->shadowed();
                 break;
             case Lexer::T_BOLD:
                 $this->currentStyle->setBold(!$this->currentStyle->isBold());
                 $this->bold();
                 break;
             case Lexer::T_ITALIC:
                 $this->currentStyle->setItalic(!$this->currentStyle->isItalic());
                 $this->italic();
                 break;
             case Lexer::T_WIDE:
                 $this->currentStyle->setWidth(2);
                 $this->wide();
                 break;
             case Lexer::T_NARROW:
                 $this->currentStyle->setWidth(0);
                 $this->narrow();
                 break;
             case Lexer::T_MEDIUM:
                 $this->currentStyle->setWidth(1);
                 $this->medium();
                 break;
             case Lexer::T_UPPERCASE:
                 $this->currentStyle->setUppercase(!$this->currentStyle->isUppercase());
                 $this->upperCase();
                 break;
             case Lexer::T_RESET_ALL:
                 if ($this->stylesStack) {
                     $style = $this->stylesStack[count($this->stylesStack) - 1];
                 } else {
                     $style = new Style();
                 }
                 $this->currentStyle = $style;
                 $this->isInLink = false;
                 $this->resetAll();
                 break;
             case Lexer::T_PUSH:
                 array_push($this->stylesStack, $this->currentStyle);
                 $this->currentStyle = clone $this->currentStyle;
                 $this->pushStyle();
                 break;
             case Lexer::T_POP:
                 if (count($this->stylesStack)) {
                     $this->currentStyle = array_pop($this->stylesStack);
                 }
                 $this->popStyle();
                 break;
             case Lexer::T_EXTERNAL_LINK:
                 $this->isInLink = !$this->isInLink;
                 if ($this->isInLink) {
                     $link = $this->getLink();
                     $this->openExternalLink($link);
                 } else {
                     $this->closeExternalLink();
                 }
                 break;
             case Lexer::T_INTERNAL_LINK:
                 $this->isInLink = !$this->isInLink;
                 if ($this->isInLink) {
                     $link = $this->getLink();
                     $this->openInternalLink($link);
                 } else {
                     $this->closeInternalLink();
                 }
                 break;
             case Lexer::T_UNKNOWN_MARKUP:
                 // We do nothing with unknown markup for the moment
                 break;
         }
     }
//.........這裏部分代碼省略.........
開發者ID:manialib,項目名稱:formatting,代碼行數:101,代碼來源:Parser.php


注:本文中的Style::setColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。