Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/Sabberworm/CSS/CSSList/CSSList.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,39 @@ public function getLineNo() {
return $this->iLineNo;
}

/**
* Prepend item to list of contents.
*
* @param object $oItem Item.
*/
public function prepend($oItem) {
array_unshift($this->aContents, $oItem);
}

/**
* Append item to list of contents.
*
* @param object $oItem Item.
*/
public function append($oItem) {
$this->aContents[] = $oItem;
}

/**
* Splice the list of contents.
*
* @param int $iOffset Offset.
* @param int $iLength Length. Optional.
* @param RuleSet[] $mReplacement Replacement. Optional.
*/
public function splice($iOffset, $iLength = null, $mReplacement = null) {
array_splice($this->aContents, $iOffset, $iLength, $mReplacement);
}

/**
* Removes an item from the CSS list.
* @param RuleSet|Import|Charset|CSSList $oItemToRemove May be a RuleSet (most likely a DeclarationBlock), a Import, a Charset or another CSSList (most likely a MediaQuery)
* @return bool Whether the item was removed.
*/
public function remove($oItemToRemove) {
$iKey = array_search($oItemToRemove, $this->aContents, true);
Expand Down