css-sanitizer
Classes to parse and sanitize CSS
Loading...
Searching...
No Matches
Wikimedia\CSS\Util Class Reference

Static utility functions. More...

Static Public Member Functions

static assertAllInstanceOf (array $array, $class, $what)
 Check that all elements in an array implement a particular class.
 
static assertAllTokensOfType (array $array, $type, $what)
 Check that a set of tokens are all the same type.
 
static findFirstNonWhitespace ( $list)
 Find the first non-whitespace ComponentValue in a list.
 
static stringify ( $object, $options=[])
 Turn a CSSObject into a string.
 

Detailed Description

Static utility functions.

Member Function Documentation

◆ assertAllInstanceOf()

static Wikimedia\CSS\Util::assertAllInstanceOf ( array $array,
$class,
$what )
static

Check that all elements in an array implement a particular class.

Parameters
array$array
string$class
string$whatDescribe the array being checked
Exceptions
InvalidArgumentException

◆ assertAllTokensOfType()

static Wikimedia\CSS\Util::assertAllTokensOfType ( array $array,
$type,
$what )
static

Check that a set of tokens are all the same type.

Parameters
Token[]$array
string$type
string$whatDescribe the array being checked
Exceptions
InvalidArgumentException

◆ findFirstNonWhitespace()

static Wikimedia\CSS\Util::findFirstNonWhitespace ( $list)
static

Find the first non-whitespace ComponentValue in a list.

Parameters
TokenList | ComponentValueList$list
Returns
ComponentValue|null

◆ stringify()

static Wikimedia\CSS\Util::stringify ( $object,
$options = [] )
static

Turn a CSSObject into a string.

Parameters
CSSObject | CSSObject[]$object
array$optionsSerialization options:
  • minify: (bool) Skip comments and insignificant tokens
Returns
string

The documentation for this class was generated from the following file: