本文整理汇总了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;
}
}
//.........这里部分代码省略.........