@@ -32,6 +32,8 @@ class Parser {
32
32
private $ sCharset ;
33
33
private $ iLength ;
34
34
private $ peekCache = null ;
35
+ private $ blockRules ;
36
+ private $ sizeUnits ;
35
37
36
38
public function __construct ($ sText , Settings $ oParserSettings = null ) {
37
39
$ this ->sText = $ sText ;
@@ -40,6 +42,8 @@ public function __construct($sText, Settings $oParserSettings = null) {
40
42
$ oParserSettings = Settings::create ();
41
43
}
42
44
$ this ->oParserSettings = $ oParserSettings ;
45
+ $ this ->blockRules = explode ('/ ' , AtRule::BLOCK_RULES );
46
+ $ this ->sizeUnits = explode ('/ ' , Size::ABSOLUTE_SIZE_UNITS .'/ ' .Size::RELATIVE_SIZE_UNITS .'/ ' .Size::NON_SIZE_UNITS );
43
47
}
44
48
45
49
public function setCharset ($ sCharset ) {
@@ -130,7 +134,7 @@ private function parseAtRule() {
130
134
$ sArgs = $ this ->consumeUntil ('{ ' , false , true );
131
135
$ this ->consumeWhiteSpace ();
132
136
$ bUseRuleSet = true ;
133
- foreach (explode ( ' / ' , AtRule:: BLOCK_RULES ) as $ sBlockRuleName ) {
137
+ foreach ($ this -> blockRules as $ sBlockRuleName ) {
134
138
if (self ::identifierIs ($ sIdentifier , $ sBlockRuleName )) {
135
139
$ bUseRuleSet = false ;
136
140
break ;
@@ -393,7 +397,7 @@ private function parseNumericValue($bForColor = false) {
393
397
}
394
398
$ fSize = floatval ($ sSize );
395
399
$ sUnit = null ;
396
- foreach (explode ( ' / ' , Size:: ABSOLUTE_SIZE_UNITS . ' / ' .Size:: RELATIVE_SIZE_UNITS . ' / ' .Size:: NON_SIZE_UNITS ) as $ sDefinedUnit ) {
400
+ foreach ($ this -> sizeUnits as $ sDefinedUnit ) {
397
401
if ($ this ->comes ($ sDefinedUnit , true )) {
398
402
$ sUnit = $ sDefinedUnit ;
399
403
$ this ->consume ($ sDefinedUnit );
0 commit comments