css-sanitizer
Classes to parse and sanitize CSS
Wikimedia\CSS\Objects\CSSObjectList Class Reference

Represent a list of CSS objects. More...

+ Inheritance diagram for Wikimedia\CSS\Objects\CSSObjectList:
+ Collaboration diagram for Wikimedia\CSS\Objects\CSSObjectList:

Public Member Functions

 __construct (array $objects=[])
 
 add ( $objects, $index=null)
 Insert one or more objects into the list. More...
 
 remove ( $index)
 Remove an object from the list. More...
 
 slice ( $offset, $length=null)
 Extract a slice of the list. More...
 
 clear ()
 Clear the list.
 
 count ()
 @inheritDoc
 
 seek ( $offset)
 @inheritDoc
 
 current ()
 @inheritDoc
 
 key ()
 @inheritDoc
 
 next ()
 @inheritDoc
 
 rewind ()
 @inheritDoc
 
 valid ()
 @inheritDoc
 
 offsetExists ( $offset)
 @inheritDoc
 
 offsetGet ( $offset)
 @inheritDoc
 
 offsetSet ( $offset, $value)
 @inheritDoc
 
 offsetUnset ( $offset)
 @inheritDoc
 
 getPosition ()
 @inheritDoc
 
 toTokenArray ()
 @inheritDoc
 
 toComponentValueArray ()
 @inheritDoc
 
 __toString ()
 

Protected Member Functions

 getSeparator (CSSObject $left, CSSObject $right=null)
 Return the tokens to use to separate list items. More...
 

Static Protected Member Functions

static testObjects (array $objects)
 Additional validation for objects. More...
 

Protected Attributes

 $objects
 
 $offset = 0
 

Static Protected Attributes

static $objectType
 

Detailed Description

Represent a list of CSS objects.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\CSS\Objects\CSSObjectList::__construct ( array  $objects = [])
Parameters
CSSObject[]$objects

Member Function Documentation

◆ add()

Wikimedia\CSS\Objects\CSSObjectList::add (   $objects,
  $index = null 
)

Insert one or more objects into the list.

Parameters
CSSObject | CSSObject[] | CSSObjectList$objectsAn object to add, or an array of objects.
int | null$indexInsert the objects at this index. If omitted, the objects are added at the end.

◆ getSeparator()

Wikimedia\CSS\Objects\CSSObjectList::getSeparator ( CSSObject  $left,
CSSObject  $right = null 
)
protected

Return the tokens to use to separate list items.

Parameters
CSSObject$left
CSSObject | null$right
Returns
Token[]

Reimplemented in Wikimedia\CSS\Objects\RuleList, Wikimedia\CSS\Objects\DeclarationOrAtRuleList, and Wikimedia\CSS\Objects\DeclarationList.

◆ remove()

Wikimedia\CSS\Objects\CSSObjectList::remove (   $index)

Remove an object from the list.

Parameters
int$index
Returns
CSSObject The removed object

◆ slice()

Wikimedia\CSS\Objects\CSSObjectList::slice (   $offset,
  $length = null 
)

Extract a slice of the list.

Parameters
int$offset
int | null$length
Returns
CSSObject[] The objects in the slice

◆ testObjects()

static Wikimedia\CSS\Objects\CSSObjectList::testObjects ( array  $objects)
staticprotected

Additional validation for objects.

Parameters
CSSObject[]$objects

Reimplemented in Wikimedia\CSS\Objects\ComponentValueList.


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