Skip to content

Commit 9c14b9f

Browse files
committed
add a remove method to unset a declaration block from a list
1 parent 0cf5ed8 commit 9c14b9f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/CSSList.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@
66
*/
77
abstract class CSSList {
88
private $aContents;
9-
9+
1010
public function __construct() {
1111
$this->aContents = array();
1212
}
13-
13+
1414
public function append($oItem) {
1515
$this->aContents[] = $oItem;
1616
}
17-
17+
18+
public function remove(CSSDeclarationBlock $item) {
19+
foreach ($this->aContents as $key => $oItem) {
20+
if($oItem->getSelectors() === $item->getSelectors()) {
21+
unset($this->aContents[$key]);
22+
}
23+
}
24+
}
25+
1826
public function __toString() {
1927
$sResult = '';
2028
foreach($this->aContents as $oContent) {

0 commit comments

Comments
 (0)