Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.

Commit ab8c45c

Browse files
committed
Variable renaming and removing a bit of redundant code
1 parent 4ef7e03 commit ab8c45c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/Sabberworm/CSS/Parser.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,22 +519,21 @@ private function peek($iLength = 1, $iOffset = 0) {
519519

520520
private function consume($mValue = 1) {
521521
if (is_string($mValue)) {
522-
$noLines = substr_count($mValue, "\n");
522+
$iLineCount = substr_count($mValue, "\n");
523523
$iLength = $this->strlen($mValue);
524524
if (!$this->streql($this->substr($this->iCurrentPosition, $iLength), $mValue)) {
525525
throw new UnexpectedTokenException($mValue, $this->peek(max($iLength, 5)));
526526
}
527-
$this->iLineNum += $noLines;
527+
$this->iLineNum += $iLineCount;
528528
$this->iCurrentPosition += $this->strlen($mValue);
529529
return $mValue;
530530
} else {
531-
$substring = $this->substr($this->iCurrentPosition, $mValue);
532-
$noLines = substr_count($substring, "\n");
533-
$this->iLineNum += $noLines;
534531
if ($this->iCurrentPosition + $mValue > $this->iLength) {
535532
throw new UnexpectedTokenException($mValue, $this->peek(5), 'count');
536533
}
537534
$sResult = $this->substr($this->iCurrentPosition, $mValue);
535+
$iLineCount = substr_count($sResult, "\n");
536+
$this->iLineNum += $iLineCount;
538537
$this->iCurrentPosition += $mValue;
539538
return $sResult;
540539
}

0 commit comments

Comments
 (0)