css-sanitizer
Classes to parse and sanitize CSS
Loading...
Searching...
No Matches
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.
 
 remove ( $index)
 Remove an object from the list.
 
 slice ( $offset, $length=null)
 Extract a slice of the list.
 
 clear ()
 Clear the list.
 
 count ()
 @inheritDoc
 
 seek (int $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.
 

Static Protected Member Functions

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

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.

◆ getPosition()

Wikimedia\CSS\Objects\CSSObjectList::getPosition ( )

@inheritDoc

Implements Wikimedia\CSS\Objects\CSSObject.

◆ 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\DeclarationList, Wikimedia\CSS\Objects\DeclarationOrAtRuleList, and Wikimedia\CSS\Objects\RuleList.

◆ 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.

◆ toComponentValueArray()

Wikimedia\CSS\Objects\CSSObjectList::toComponentValueArray ( )

◆ toTokenArray()

Wikimedia\CSS\Objects\CSSObjectList::toTokenArray ( )

@inheritDoc

Implements Wikimedia\CSS\Objects\CSSObject.

Reimplemented in Wikimedia\CSS\Objects\TokenList.


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