Skip to content

Commit c04b8fb

Browse files
MDL-65759 library: Add patch moodle#115 for php-css-parser
Patch taken from MyIntervals/PHP-CSS-Parser#115 as specified in moodle_readme.txt
1 parent 376eb15 commit c04b8fb

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,20 @@ public function splice($iOffset, $iLength = null, $mReplacement = null) {
212212
array_splice($this->aContents, $iOffset, $iLength, $mReplacement);
213213
}
214214

215+
/**
216+
* Insert an item before its sibling.
217+
*
218+
* @param mixed $oItem The item.
219+
* @param mixed $oSibling The sibling.
220+
*/
221+
public function insert($oItem, $oSibling) {
222+
$iIndex = array_search($oSibling, $this->aContents);
223+
if ($iIndex === false) {
224+
return $this->append($oItem);
225+
}
226+
array_splice($this->aContents, $iIndex, 0, array($oItem));
227+
}
228+
215229
/**
216230
* Removes an item from the CSS list.
217231
* @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)
@@ -314,7 +328,7 @@ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
314328

315329
return $sResult;
316330
}
317-
331+
318332
/**
319333
* Return true if the list can not be further outdented. Only important when rendering.
320334
*/

lib/php-css-parser/moodle_readme.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
PHP CSS Parser
22
--------------
33

4-
Import git ref: c3b01ef0a85824e86fd86a74a8154d8d5c34b0ff
5-
(master)
6-
7-
Downloaded from: https://github.com/sabberworm/PHP-CSS-Parser
4+
Downloaded from: https://github.com/sabberworm/PHP-CSS-Parser/releases/tag/8.3.0
85

96
Import procedure:
107

0 commit comments

Comments
 (0)