Skip to content

Commit 515cead

Browse files
Frederic Massartdanpoltawski
authored andcommitted
MDL-55381 php-css-parser: Patch for MyIntervals/PHP-CSS-Parser#115
REMOVE ME ONCE MyIntervals/PHP-CSS-Parser#115 is merged Part of MDL-55071
1 parent 66bb9ea commit 515cead

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lib/php-css-parser/CSSList/CSSList.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ public function append($oItem) {
3535
$this->aContents[] = $oItem;
3636
}
3737

38+
/**
39+
* Insert an item before its sibling.
40+
*
41+
* @param mixed $oItem The item.
42+
* @param mixed $oSibling The sibling.
43+
*/
44+
public function insert($oItem, $oSibling) {
45+
$iIndex = array_search($oSibling, $this->aContents);
46+
if ($iIndex === false) {
47+
return $this->append($oItem);
48+
}
49+
array_splice($this->aContents, $iIndex, 0, array($oItem));
50+
}
51+
3852
/**
3953
* Removes an item from the CSS list.
4054
* @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)

lib/php-css-parser/moodle_readme.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ Downloaded from: https://github.com/sabberworm/PHP-CSS-Parser
99
Import procedure:
1010

1111
- Copy all the files from the folder 'lib/Sabberworm/CSS/' in this directory.
12+
13+
- Apply the patch in Sabberworm/PHP-CSS-Parser#115

0 commit comments

Comments
 (0)