Skip to content

Commit 24e69d4

Browse files
authored
[CLEANUP] Avoid Hungarian notation for aContents and items (#854)
Part of #756
1 parent 3a147fd commit 24e69d4

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

src/CSSList/CSSBlockList.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ public function __construct($lineNumber = 0)
3333
*/
3434
protected function allDeclarationBlocks(array &$result): void
3535
{
36-
foreach ($this->aContents as $mContent) {
37-
if ($mContent instanceof DeclarationBlock) {
38-
$result[] = $mContent;
39-
} elseif ($mContent instanceof CSSBlockList) {
40-
$mContent->allDeclarationBlocks($result);
36+
foreach ($this->contents as $item) {
37+
if ($item instanceof DeclarationBlock) {
38+
$result[] = $item;
39+
} elseif ($item instanceof CSSBlockList) {
40+
$item->allDeclarationBlocks($result);
4141
}
4242
}
4343
}
@@ -47,11 +47,11 @@ protected function allDeclarationBlocks(array &$result): void
4747
*/
4848
protected function allRuleSets(array &$result): void
4949
{
50-
foreach ($this->aContents as $mContent) {
51-
if ($mContent instanceof RuleSet) {
52-
$result[] = $mContent;
53-
} elseif ($mContent instanceof CSSBlockList) {
54-
$mContent->allRuleSets($result);
50+
foreach ($this->contents as $item) {
51+
if ($item instanceof RuleSet) {
52+
$result[] = $item;
53+
} elseif ($item instanceof CSSBlockList) {
54+
$item->allRuleSets($result);
5555
}
5656
}
5757
}

src/CSSList/CSSList.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ abstract class CSSList implements Renderable, Commentable
4141
/**
4242
* @var array<int, RuleSet|CSSList|Import|Charset>
4343
*/
44-
protected $aContents;
44+
protected $contents;
4545

4646
/**
4747
* @var int
@@ -54,7 +54,7 @@ abstract class CSSList implements Renderable, Commentable
5454
public function __construct($lineNumber = 0)
5555
{
5656
$this->comments = [];
57-
$this->aContents = [];
57+
$this->contents = [];
5858
$this->lineNumber = $lineNumber;
5959
}
6060

@@ -259,21 +259,21 @@ public function getLineNo()
259259
/**
260260
* Prepends an item to the list of contents.
261261
*
262-
* @param RuleSet|CSSList|Import|Charset $oItem
262+
* @param RuleSet|CSSList|Import|Charset $item
263263
*/
264-
public function prepend($oItem): void
264+
public function prepend($item): void
265265
{
266-
\array_unshift($this->aContents, $oItem);
266+
\array_unshift($this->contents, $item);
267267
}
268268

269269
/**
270270
* Appends an item to the list of contents.
271271
*
272-
* @param RuleSet|CSSList|Import|Charset $oItem
272+
* @param RuleSet|CSSList|Import|Charset $item
273273
*/
274-
public function append($oItem): void
274+
public function append($item): void
275275
{
276-
$this->aContents[] = $oItem;
276+
$this->contents[] = $item;
277277
}
278278

279279
/**
@@ -285,7 +285,7 @@ public function append($oItem): void
285285
*/
286286
public function splice($iOffset, $iLength = null, $mReplacement = null): void
287287
{
288-
\array_splice($this->aContents, $iOffset, $iLength, $mReplacement);
288+
\array_splice($this->contents, $iOffset, $iLength, $mReplacement);
289289
}
290290

291291
/**
@@ -297,7 +297,7 @@ public function splice($iOffset, $iLength = null, $mReplacement = null): void
297297
*/
298298
public function insertBefore($item, $sibling): void
299299
{
300-
if (\in_array($sibling, $this->aContents, true)) {
300+
if (\in_array($sibling, $this->contents, true)) {
301301
$this->replace($sibling, [$item, $sibling]);
302302
} else {
303303
$this->append($item);
@@ -307,17 +307,17 @@ public function insertBefore($item, $sibling): void
307307
/**
308308
* Removes an item from the CSS list.
309309
*
310-
* @param RuleSet|Import|Charset|CSSList $oItemToRemove
310+
* @param RuleSet|Import|Charset|CSSList $itemToRemove
311311
* May be a `RuleSet` (most likely a `DeclarationBlock`), an `Import`,
312312
* a `Charset` or another `CSSList` (most likely a `MediaQuery`)
313313
*
314314
* @return bool whether the item was removed
315315
*/
316-
public function remove($oItemToRemove)
316+
public function remove($itemToRemove)
317317
{
318-
$iKey = \array_search($oItemToRemove, $this->aContents, true);
318+
$iKey = \array_search($itemToRemove, $this->contents, true);
319319
if ($iKey !== false) {
320-
unset($this->aContents[$iKey]);
320+
unset($this->contents[$iKey]);
321321
return true;
322322
}
323323
return false;
@@ -326,33 +326,33 @@ public function remove($oItemToRemove)
326326
/**
327327
* Replaces an item from the CSS list.
328328
*
329-
* @param RuleSet|Import|Charset|CSSList $oOldItem
329+
* @param RuleSet|Import|Charset|CSSList $oldItem
330330
* May be a `RuleSet` (most likely a `DeclarationBlock`), an `Import`, a `Charset`
331331
* or another `CSSList` (most likely a `MediaQuery`)
332332
*
333333
* @return bool
334334
*/
335-
public function replace($oOldItem, $mNewItem)
335+
public function replace($oldItem, $newItem)
336336
{
337-
$iKey = \array_search($oOldItem, $this->aContents, true);
337+
$iKey = \array_search($oldItem, $this->contents, true);
338338
if ($iKey !== false) {
339-
if (\is_array($mNewItem)) {
340-
\array_splice($this->aContents, $iKey, 1, $mNewItem);
339+
if (\is_array($newItem)) {
340+
\array_splice($this->contents, $iKey, 1, $newItem);
341341
} else {
342-
\array_splice($this->aContents, $iKey, 1, [$mNewItem]);
342+
\array_splice($this->contents, $iKey, 1, [$newItem]);
343343
}
344344
return true;
345345
}
346346
return false;
347347
}
348348

349349
/**
350-
* @param array<int, RuleSet|Import|Charset|CSSList> $aContents
350+
* @param array<int, RuleSet|Import|Charset|CSSList> $contents
351351
*/
352-
public function setContents(array $aContents): void
352+
public function setContents(array $contents): void
353353
{
354-
$this->aContents = [];
355-
foreach ($aContents as $content) {
354+
$this->contents = [];
355+
foreach ($contents as $content) {
356356
$this->append($content);
357357
}
358358
}
@@ -383,12 +383,12 @@ public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false
383383
$mSel = new Selector($mSel);
384384
}
385385
}
386-
foreach ($this->aContents as $iKey => $mItem) {
387-
if (!($mItem instanceof DeclarationBlock)) {
386+
foreach ($this->contents as $iKey => $item) {
387+
if (!($item instanceof DeclarationBlock)) {
388388
continue;
389389
}
390-
if ($mItem->getSelectors() == $mSelector) {
391-
unset($this->aContents[$iKey]);
390+
if ($item->getSelectors() == $mSelector) {
391+
unset($this->contents[$iKey]);
392392
if (!$bRemoveAll) {
393393
return;
394394
}
@@ -412,9 +412,9 @@ protected function renderListContents(OutputFormat $oOutputFormat)
412412
if (!$this->isRootList()) {
413413
$oNextLevel = $oOutputFormat->nextLevel();
414414
}
415-
foreach ($this->aContents as $oContent) {
416-
$sRendered = $oOutputFormat->safely(static function () use ($oNextLevel, $oContent): string {
417-
return $oContent->render($oNextLevel);
415+
foreach ($this->contents as $listItem) {
416+
$sRendered = $oOutputFormat->safely(static function () use ($oNextLevel, $listItem): string {
417+
return $listItem->render($oNextLevel);
418418
});
419419
if ($sRendered === null) {
420420
continue;
@@ -450,7 +450,7 @@ abstract public function isRootList();
450450
*/
451451
public function getContents()
452452
{
453-
return $this->aContents;
453+
return $this->contents;
454454
}
455455

456456
/**

0 commit comments

Comments
 (0)