Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/CSSList/CSSList.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ public function insertBefore($item, $sibling): void
*/
public function remove($itemToRemove)
{
$iKey = \array_search($itemToRemove, $this->contents, true);
if ($iKey !== false) {
unset($this->contents[$iKey]);
$key = \array_search($itemToRemove, $this->contents, true);
if ($key !== false) {
unset($this->contents[$key]);
return true;
}
return false;
Expand All @@ -334,12 +334,12 @@ public function remove($itemToRemove)
*/
public function replace($oldItem, $newItem)
{
$iKey = \array_search($oldItem, $this->contents, true);
if ($iKey !== false) {
$key = \array_search($oldItem, $this->contents, true);
if ($key !== false) {
if (\is_array($newItem)) {
\array_splice($this->contents, $iKey, 1, $newItem);
\array_splice($this->contents, $key, 1, $newItem);
} else {
\array_splice($this->contents, $iKey, 1, [$newItem]);
\array_splice($this->contents, $key, 1, [$newItem]);
}
return true;
}
Expand Down Expand Up @@ -371,7 +371,7 @@ public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false
if (!\is_array($mSelector)) {
$mSelector = \explode(',', $mSelector);
}
foreach ($mSelector as $iKey => &$mSel) {
foreach ($mSelector as $key => &$mSel) {
if (!($mSel instanceof Selector)) {
if (!Selector::isValid($mSel)) {
throw new UnexpectedTokenException(
Expand All @@ -383,12 +383,12 @@ public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false
$mSel = new Selector($mSel);
}
}
foreach ($this->contents as $iKey => $item) {
foreach ($this->contents as $key => $item) {
if (!($item instanceof DeclarationBlock)) {
continue;
}
if ($item->getSelectors() == $mSelector) {
unset($this->contents[$iKey]);
unset($this->contents[$key]);
if (!$bRemoveAll) {
return;
}
Expand Down
10 changes: 5 additions & 5 deletions src/RuleSet/DeclarationBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function setSelectors($mSelector, $oList = null): void
} else {
$this->aSelectors = \explode(',', $mSelector);
}
foreach ($this->aSelectors as $iKey => $mSelector) {
foreach ($this->aSelectors as $key => $mSelector) {
if (!($mSelector instanceof Selector)) {
if ($oList === null || !($oList instanceof KeyFrame)) {
if (!Selector::isValid($mSelector)) {
Expand All @@ -106,7 +106,7 @@ public function setSelectors($mSelector, $oList = null): void
'custom'
);
}
$this->aSelectors[$iKey] = new Selector($mSelector);
$this->aSelectors[$key] = new Selector($mSelector);
} else {
if (!KeyframeSelector::isValid($mSelector)) {
throw new UnexpectedTokenException(
Expand All @@ -115,7 +115,7 @@ public function setSelectors($mSelector, $oList = null): void
'custom'
);
}
$this->aSelectors[$iKey] = new KeyframeSelector($mSelector);
$this->aSelectors[$key] = new KeyframeSelector($mSelector);
}
}
}
Expand All @@ -131,9 +131,9 @@ public function removeSelector($mSelector): bool
if ($mSelector instanceof Selector) {
$mSelector = $mSelector->getSelector();
}
foreach ($this->aSelectors as $iKey => $selector) {
foreach ($this->aSelectors as $key => $selector) {
if ($selector->getSelector() === $mSelector) {
unset($this->aSelectors[$iKey]);
unset($this->aSelectors[$key]);
return true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/RuleSet/RuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ public function removeRule($mRule): void
if (!isset($this->aRules[$sRule])) {
return;
}
foreach ($this->aRules[$sRule] as $iKey => $rule) {
foreach ($this->aRules[$sRule] as $key => $rule) {
if ($rule === $mRule) {
unset($this->aRules[$sRule][$iKey]);
unset($this->aRules[$sRule][$key]);
}
}
} else {
Expand Down