css-sanitizer
Classes to parse and sanitize CSS
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. More...
 
static assertAllTokensOfType (array $array, $type, $what)
 Check that a set of tokens are all of the same type. More...
 
static findFirstNonWhitespace ( $list)
 Find the first non-whitespace ComponentValue in a list. More...
 
static stringify ( $object, $options=[])
 Turn a CSSObject into a string. More...
 

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

◆ assertAllTokensOfType()

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

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

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

◆ 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$optionsSerialziation options:
  • minify: (bool) Skip comments and insignificant tokens
Returns
string

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