@@ -64,7 +64,7 @@ public function __construct($lineNumber = 0)
6464 */
6565 public static function parseList (ParserState $ parserState , CSSList $ list ): void
6666 {
67- $ bIsRoot = $ list instanceof Document;
67+ $ isRoot = $ list instanceof Document;
6868 if (\is_string ($ parserState )) {
6969 $ parserState = new ParserState ($ parserState , Settings::create ());
7070 }
@@ -93,7 +93,7 @@ public static function parseList(ParserState $parserState, CSSList $list): void
9393 $ comments = $ parserState ->consumeWhiteSpace ();
9494 }
9595 $ list ->addComments ($ comments );
96- if (!$ bIsRoot && !$ usesLenientParsing ) {
96+ if (!$ isRoot && !$ usesLenientParsing ) {
9797 throw new SourceException ('Unexpected end of document ' , $ parserState ->currentLine ());
9898 }
9999 }
@@ -107,11 +107,11 @@ public static function parseList(ParserState $parserState, CSSList $list): void
107107 */
108108 private static function parseListItem (ParserState $ parserState , CSSList $ list )
109109 {
110- $ bIsRoot = $ list instanceof Document;
110+ $ isRoot = $ list instanceof Document;
111111 if ($ parserState ->comes ('@ ' )) {
112- $ oAtRule = self ::parseAtRule ($ parserState );
113- if ($ oAtRule instanceof Charset) {
114- if (!$ bIsRoot ) {
112+ $ atRule = self ::parseAtRule ($ parserState );
113+ if ($ atRule instanceof Charset) {
114+ if (!$ isRoot ) {
115115 throw new UnexpectedTokenException (
116116 '@charset may only occur in root document ' ,
117117 '' ,
@@ -127,11 +127,11 @@ private static function parseListItem(ParserState $parserState, CSSList $list)
127127 $ parserState ->currentLine ()
128128 );
129129 }
130- $ parserState ->setCharset ($ oAtRule ->getCharset ());
130+ $ parserState ->setCharset ($ atRule ->getCharset ());
131131 }
132- return $ oAtRule ;
132+ return $ atRule ;
133133 } elseif ($ parserState ->comes ('} ' )) {
134- if ($ bIsRoot ) {
134+ if ($ isRoot ) {
135135 if ($ parserState ->getSettings ()->bLenientParsing ) {
136136 return DeclarationBlock::parse ($ parserState );
137137 } else {
@@ -157,7 +157,7 @@ private static function parseAtRule(ParserState $parserState)
157157 {
158158 $ parserState ->consume ('@ ' );
159159 $ identifier = $ parserState ->parseIdentifier ();
160- $ iIdentifierLineNum = $ parserState ->currentLine ();
160+ $ identifierLineNumber = $ parserState ->currentLine ();
161161 $ parserState ->consumeWhiteSpace ();
162162 if ($ identifier === 'import ' ) {
163163 $ location = URL ::parse ($ parserState );
@@ -170,14 +170,14 @@ private static function parseAtRule(ParserState $parserState)
170170 }
171171 }
172172 $ parserState ->consumeUntil (['; ' , ParserState::EOF ], true , true );
173- return new Import ($ location , $ mediaQuery , $ iIdentifierLineNum );
173+ return new Import ($ location , $ mediaQuery , $ identifierLineNumber );
174174 } elseif ($ identifier === 'charset ' ) {
175- $ oCharsetString = CSSString::parse ($ parserState );
175+ $ charsetString = CSSString::parse ($ parserState );
176176 $ parserState ->consumeWhiteSpace ();
177177 $ parserState ->consumeUntil (['; ' , ParserState::EOF ], true , true );
178- return new Charset ($ oCharsetString , $ iIdentifierLineNum );
178+ return new Charset ($ charsetString , $ identifierLineNumber );
179179 } elseif (self ::identifierIs ($ identifier , 'keyframes ' )) {
180- $ result = new KeyFrame ($ iIdentifierLineNum );
180+ $ result = new KeyFrame ($ identifierLineNumber );
181181 $ result ->setVendorKeyFrame ($ identifier );
182182 $ result ->setAnimationName (\trim ($ parserState ->consumeUntil ('{ ' , false , true )));
183183 CSSList::parseList ($ parserState , $ result );
@@ -187,52 +187,52 @@ private static function parseAtRule(ParserState $parserState)
187187 return $ result ;
188188 } elseif ($ identifier === 'namespace ' ) {
189189 $ sPrefix = null ;
190- $ mUrl = Value::parsePrimitiveValue ($ parserState );
190+ $ url = Value::parsePrimitiveValue ($ parserState );
191191 if (!$ parserState ->comes ('; ' )) {
192- $ sPrefix = $ mUrl ;
193- $ mUrl = Value::parsePrimitiveValue ($ parserState );
192+ $ sPrefix = $ url ;
193+ $ url = Value::parsePrimitiveValue ($ parserState );
194194 }
195195 $ parserState ->consumeUntil (['; ' , ParserState::EOF ], true , true );
196196 if ($ sPrefix !== null && !\is_string ($ sPrefix )) {
197- throw new UnexpectedTokenException ('Wrong namespace prefix ' , $ sPrefix , 'custom ' , $ iIdentifierLineNum );
197+ throw new UnexpectedTokenException ('Wrong namespace prefix ' , $ sPrefix , 'custom ' , $ identifierLineNumber );
198198 }
199- if (!($ mUrl instanceof CSSString || $ mUrl instanceof URL )) {
199+ if (!($ url instanceof CSSString || $ url instanceof URL )) {
200200 throw new UnexpectedTokenException (
201201 'Wrong namespace url of invalid type ' ,
202- $ mUrl ,
202+ $ url ,
203203 'custom ' ,
204- $ iIdentifierLineNum
204+ $ identifierLineNumber
205205 );
206206 }
207- return new CSSNamespace ($ mUrl , $ sPrefix , $ iIdentifierLineNum );
207+ return new CSSNamespace ($ url , $ sPrefix , $ identifierLineNumber );
208208 } else {
209209 // Unknown other at rule (font-face or such)
210- $ sArgs = \trim ($ parserState ->consumeUntil ('{ ' , false , true ));
211- if (\substr_count ($ sArgs , '( ' ) != \substr_count ($ sArgs , ') ' )) {
210+ $ arguments = \trim ($ parserState ->consumeUntil ('{ ' , false , true ));
211+ if (\substr_count ($ arguments , '( ' ) != \substr_count ($ arguments , ') ' )) {
212212 if ($ parserState ->getSettings ()->bLenientParsing ) {
213213 return null ;
214214 } else {
215215 throw new SourceException ('Unmatched brace count in media query ' , $ parserState ->currentLine ());
216216 }
217217 }
218- $ bUseRuleSet = true ;
219- foreach (\explode ('/ ' , AtRule::BLOCK_RULES ) as $ sBlockRuleName ) {
220- if (self ::identifierIs ($ identifier , $ sBlockRuleName )) {
221- $ bUseRuleSet = false ;
218+ $ useRuleSet = true ;
219+ foreach (\explode ('/ ' , AtRule::BLOCK_RULES ) as $ blockRuleName ) {
220+ if (self ::identifierIs ($ identifier , $ blockRuleName )) {
221+ $ useRuleSet = false ;
222222 break ;
223223 }
224224 }
225- if ($ bUseRuleSet ) {
226- $ oAtRule = new AtRuleSet ($ identifier , $ sArgs , $ iIdentifierLineNum );
227- RuleSet::parseRuleSet ($ parserState , $ oAtRule );
225+ if ($ useRuleSet ) {
226+ $ atRule = new AtRuleSet ($ identifier , $ arguments , $ identifierLineNumber );
227+ RuleSet::parseRuleSet ($ parserState , $ atRule );
228228 } else {
229- $ oAtRule = new AtRuleBlockList ($ identifier , $ sArgs , $ iIdentifierLineNum );
230- CSSList::parseList ($ parserState , $ oAtRule );
229+ $ atRule = new AtRuleBlockList ($ identifier , $ arguments , $ identifierLineNumber );
230+ CSSList::parseList ($ parserState , $ atRule );
231231 if ($ parserState ->comes ('} ' )) {
232232 $ parserState ->consume ('} ' );
233233 }
234234 }
235- return $ oAtRule ;
235+ return $ atRule ;
236236 }
237237 }
238238
@@ -242,10 +242,10 @@ private static function parseAtRule(ParserState $parserState)
242242 *
243243 * @param string $identifier
244244 */
245- private static function identifierIs ($ identifier , string $ sMatch ): bool
245+ private static function identifierIs ($ identifier , string $ match ): bool
246246 {
247- return (\strcasecmp ($ identifier , $ sMatch ) === 0 )
248- ?: \preg_match ("/^(- \\w+-)? $ sMatch $/i " , $ identifier ) === 1 ;
247+ return (\strcasecmp ($ identifier , $ match ) === 0 )
248+ ?: \preg_match ("/^(- \\w+-)? $ match $/i " , $ identifier ) === 1 ;
249249 }
250250
251251 /**
@@ -279,13 +279,13 @@ public function append($item): void
279279 /**
280280 * Splices the list of contents.
281281 *
282- * @param int $iOffset
283- * @param int $iLength
284- * @param array<int, RuleSet|CSSList|Import|Charset> $mReplacement
282+ * @param int $offset
283+ * @param int $length
284+ * @param array<int, RuleSet|CSSList|Import|Charset> $replacement
285285 */
286- public function splice ($ iOffset , $ iLength = null , $ mReplacement = null ): void
286+ public function splice ($ offset , $ length = null , $ replacement = null ): void
287287 {
288- \array_splice ($ this ->contents , $ iOffset , $ iLength , $ mReplacement );
288+ \array_splice ($ this ->contents , $ offset , $ length , $ replacement );
289289 }
290290
291291 /**
@@ -360,36 +360,36 @@ public function setContents(array $contents): void
360360 /**
361361 * Removes a declaration block from the CSS list if it matches all given selectors.
362362 *
363- * @param DeclarationBlock|array<array-key, Selector>|string $mSelector the selectors to match
364- * @param bool $bRemoveAll whether to stop at the first declaration block found or remove all blocks
363+ * @param DeclarationBlock|array<array-key, Selector>|string $selectors the selectors to match
364+ * @param bool $removeAll whether to stop at the first declaration block found or remove all blocks
365365 */
366- public function removeDeclarationBlockBySelector ($ mSelector , $ bRemoveAll = false ): void
366+ public function removeDeclarationBlockBySelector ($ selectors , $ removeAll = false ): void
367367 {
368- if ($ mSelector instanceof DeclarationBlock) {
369- $ mSelector = $ mSelector ->getSelectors ();
368+ if ($ selectors instanceof DeclarationBlock) {
369+ $ selectors = $ selectors ->getSelectors ();
370370 }
371- if (!\is_array ($ mSelector )) {
372- $ mSelector = \explode (', ' , $ mSelector );
371+ if (!\is_array ($ selectors )) {
372+ $ selectors = \explode (', ' , $ selectors );
373373 }
374- foreach ($ mSelector as $ key => &$ mSel ) {
375- if (!($ mSel instanceof Selector)) {
376- if (!Selector::isValid ($ mSel )) {
374+ foreach ($ selectors as $ key => &$ selector ) {
375+ if (!($ selector instanceof Selector)) {
376+ if (!Selector::isValid ($ selector )) {
377377 throw new UnexpectedTokenException (
378378 "Selector did not match ' " . Selector::SELECTOR_VALIDATION_RX . "'. " ,
379- $ mSel ,
379+ $ selector ,
380380 'custom '
381381 );
382382 }
383- $ mSel = new Selector ($ mSel );
383+ $ selector = new Selector ($ selector );
384384 }
385385 }
386386 foreach ($ this ->contents as $ key => $ item ) {
387387 if (!($ item instanceof DeclarationBlock)) {
388388 continue ;
389389 }
390- if ($ item ->getSelectors () == $ mSelector ) {
390+ if ($ item ->getSelectors () == $ selectors ) {
391391 unset($ this ->contents [$ key ]);
392- if (!$ bRemoveAll ) {
392+ if (!$ removeAll ) {
393393 return ;
394394 }
395395 }
@@ -406,34 +406,34 @@ public function __toString(): string
406406 */
407407 protected function renderListContents (OutputFormat $ oOutputFormat )
408408 {
409- $ sResult = '' ;
410- $ bIsFirst = true ;
411- $ oNextLevel = $ oOutputFormat ;
409+ $ result = '' ;
410+ $ isFirst = true ;
411+ $ nextLevelFormat = $ oOutputFormat ;
412412 if (!$ this ->isRootList ()) {
413- $ oNextLevel = $ oOutputFormat ->nextLevel ();
413+ $ nextLevelFormat = $ oOutputFormat ->nextLevel ();
414414 }
415415 foreach ($ this ->contents as $ listItem ) {
416- $ sRendered = $ oOutputFormat ->safely (static function () use ($ oNextLevel , $ listItem ): string {
417- return $ listItem ->render ($ oNextLevel );
416+ $ renderedCss = $ oOutputFormat ->safely (static function () use ($ nextLevelFormat , $ listItem ): string {
417+ return $ listItem ->render ($ nextLevelFormat );
418418 });
419- if ($ sRendered === null ) {
419+ if ($ renderedCss === null ) {
420420 continue ;
421421 }
422- if ($ bIsFirst ) {
423- $ bIsFirst = false ;
424- $ sResult .= $ oNextLevel ->spaceBeforeBlocks ();
422+ if ($ isFirst ) {
423+ $ isFirst = false ;
424+ $ result .= $ nextLevelFormat ->spaceBeforeBlocks ();
425425 } else {
426- $ sResult .= $ oNextLevel ->spaceBetweenBlocks ();
426+ $ result .= $ nextLevelFormat ->spaceBetweenBlocks ();
427427 }
428- $ sResult .= $ sRendered ;
428+ $ result .= $ renderedCss ;
429429 }
430430
431- if (!$ bIsFirst ) {
431+ if (!$ isFirst ) {
432432 // Had some output
433- $ sResult .= $ oOutputFormat ->spaceAfterBlocks ();
433+ $ result .= $ oOutputFormat ->spaceAfterBlocks ();
434434 }
435435
436- return $ sResult ;
436+ return $ result ;
437437 }
438438
439439 /**
0 commit comments