css-sanitizer
Classes to parse and sanitize CSS
|
Represent a CSS token. More...
Public Member Functions | |
__construct ( $type, $value=[]) | |
type () | |
Get the type of this token. | |
value () | |
Get the value of this token. | |
typeFlag () | |
Get the type flag for this T_HASH or numeric token. | |
representation () | |
Get the representation for this numeric token. | |
unit () | |
Get the unit for this T_DIMENSION token. | |
significant () | |
Whether this token is considered "significant". | |
copyWithSignificance ( $significant) | |
Make a copy of this token with altered "significant" flag. | |
toTokenArray () | |
@inheritDoc | |
toComponentValueArray () | |
@inheritDoc | |
__toString () | |
urangeHack ( $hack=null) | |
Allow for marking the 'U' T_IDENT beginning a <urange>, to later avoid serializing it with extraneous comments. | |
Public Member Functions inherited from Wikimedia\CSS\Objects\ComponentValue | |
getPosition () | |
Get the position of this ComponentValue in the input stream. | |
Static Public Member Functions | |
static | separate (Token $firstToken, Token $secondToken) |
Indicate whether the two tokens need to be separated. | |
Protected Attributes | |
$type | |
$value = '' | |
$typeFlag = '' | |
$representation = null | |
$unit = '' | |
$significant = true | |
Protected Attributes inherited from Wikimedia\CSS\Objects\ComponentValue | |
$line = -1 | |
$pos = -1 | |
Represent a CSS token.
Wikimedia\CSS\Objects\Token::__construct | ( | $type, | |
$value = [] ) |
string | $type | One of the T_* constants |
string | array | $value | Value of the token, or an array with the following keys. Depending on the type, some keys may be required and some may be ignored.
|
Wikimedia\CSS\Objects\Token::copyWithSignificance | ( | $significant | ) |
Make a copy of this token with altered "significant" flag.
bool | $significant | Whether the new token is considered "significant" |
Wikimedia\CSS\Objects\Token::representation | ( | ) |
Get the representation for this numeric token.
Indicate whether the two tokens need to be separated.
Token | $firstToken | |
Token | $secondToken |
bool Whether this token is considered Wikimedia\CSS\Objects\Token::significant | ( | ) |
Whether this token is considered "significant".
A token that isn't "significant" may be removed for minification of CSS. For example, most whitespace is entirely optional, as is the semicolon after the last declaration in a block.
Wikimedia\CSS\Objects\Token::toComponentValueArray | ( | ) |
@inheritDoc
Reimplemented from Wikimedia\CSS\Objects\ComponentValue.
Wikimedia\CSS\Objects\Token::toTokenArray | ( | ) |
@inheritDoc
Implements Wikimedia\CSS\Objects\CSSObject.
Wikimedia\CSS\Objects\Token::type | ( | ) |
Get the type of this token.
Wikimedia\CSS\Objects\Token::typeFlag | ( | ) |
Get the type flag for this T_HASH or numeric token.
Wikimedia\CSS\Objects\Token::unit | ( | ) |
Get the unit for this T_DIMENSION token.
Wikimedia\CSS\Objects\Token::value | ( | ) |
Get the value of this token.