Skip to content

Commit 4526202

Browse files
authored
[CLEANUP] Avoid Hungarian notation for currentPosition (#947)
Part of #756
1 parent 8a3cc0c commit 4526202

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/Parsing/ParserState.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ParserState
3737
/**
3838
* @var int
3939
*/
40-
private $iCurrentPosition = 0;
40+
private $currentPosition = 0;
4141

4242
/**
4343
* will only be used if the CSS does not contain an `@charset` declaration
@@ -95,7 +95,7 @@ public function currentLine()
9595
*/
9696
public function currentColumn()
9797
{
98-
return $this->iCurrentPosition;
98+
return $this->currentPosition;
9999
}
100100

101101
/**
@@ -108,15 +108,15 @@ public function getSettings()
108108

109109
public function anchor(): Anchor
110110
{
111-
return new Anchor($this->iCurrentPosition, $this);
111+
return new Anchor($this->currentPosition, $this);
112112
}
113113

114114
/**
115115
* @param int $position
116116
*/
117117
public function setPosition($position): void
118118
{
119-
$this->iCurrentPosition = $position;
119+
$this->currentPosition = $position;
120120
}
121121

122122
/**
@@ -233,7 +233,7 @@ public function consumeWhiteSpace(): array
233233
try {
234234
$oComment = $this->consumeComment();
235235
} catch (UnexpectedEOFException $e) {
236-
$this->iCurrentPosition = $this->iLength;
236+
$this->currentPosition = $this->iLength;
237237
return $comments;
238238
}
239239
} else {
@@ -264,7 +264,7 @@ public function comes($sString, $bCaseInsensitive = false): bool
264264
*/
265265
public function peek($iLength = 1, $iOffset = 0): string
266266
{
267-
$iOffset += $this->iCurrentPosition;
267+
$iOffset += $this->currentPosition;
268268
if ($iOffset >= $this->iLength) {
269269
return '';
270270
}
@@ -282,7 +282,7 @@ public function consume($mValue = 1): string
282282
if (\is_string($mValue)) {
283283
$iLineCount = \substr_count($mValue, "\n");
284284
$iLength = $this->strlen($mValue);
285-
if (!$this->streql($this->substr($this->iCurrentPosition, $iLength), $mValue)) {
285+
if (!$this->streql($this->substr($this->currentPosition, $iLength), $mValue)) {
286286
throw new UnexpectedTokenException(
287287
$mValue,
288288
$this->peek(\max($iLength, 5)),
@@ -291,16 +291,16 @@ public function consume($mValue = 1): string
291291
);
292292
}
293293
$this->lineNumber += $iLineCount;
294-
$this->iCurrentPosition += $this->strlen($mValue);
294+
$this->currentPosition += $this->strlen($mValue);
295295
return $mValue;
296296
} else {
297-
if ($this->iCurrentPosition + $mValue > $this->iLength) {
297+
if ($this->currentPosition + $mValue > $this->iLength) {
298298
throw new UnexpectedEOFException((string) $mValue, $this->peek(5), 'count', $this->lineNumber);
299299
}
300-
$result = $this->substr($this->iCurrentPosition, $mValue);
300+
$result = $this->substr($this->currentPosition, $mValue);
301301
$iLineCount = \substr_count($result, "\n");
302302
$this->lineNumber += $iLineCount;
303-
$this->iCurrentPosition += $mValue;
303+
$this->currentPosition += $mValue;
304304
return $result;
305305
}
306306
}
@@ -351,7 +351,7 @@ public function consumeComment()
351351

352352
public function isEnd(): bool
353353
{
354-
return $this->iCurrentPosition >= $this->iLength;
354+
return $this->currentPosition >= $this->iLength;
355355
}
356356

357357
/**
@@ -367,15 +367,15 @@ public function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false, a
367367
{
368368
$aEnd = \is_array($aEnd) ? $aEnd : [$aEnd];
369369
$out = '';
370-
$start = $this->iCurrentPosition;
370+
$start = $this->currentPosition;
371371

372372
while (!$this->isEnd()) {
373373
$char = $this->consume(1);
374374
if (\in_array($char, $aEnd, true)) {
375375
if ($bIncludeEnd) {
376376
$out .= $char;
377377
} elseif (!$consumeEnd) {
378-
$this->iCurrentPosition -= $this->strlen($char);
378+
$this->currentPosition -= $this->strlen($char);
379379
}
380380
return $out;
381381
}
@@ -389,7 +389,7 @@ public function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false, a
389389
return $out;
390390
}
391391

392-
$this->iCurrentPosition = $start;
392+
$this->currentPosition = $start;
393393
throw new UnexpectedEOFException(
394394
'One of ("' . \implode('","', $aEnd) . '")',
395395
$this->peek(5),
@@ -400,7 +400,7 @@ public function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false, a
400400

401401
private function inputLeft(): string
402402
{
403-
return $this->substr($this->iCurrentPosition, -1);
403+
return $this->substr($this->currentPosition, -1);
404404
}
405405

406406
/**
@@ -422,7 +422,7 @@ public function streql($sString1, $sString2, $bCaseInsensitive = true): bool
422422
*/
423423
public function backtrack($iAmount): void
424424
{
425-
$this->iCurrentPosition -= $iAmount;
425+
$this->currentPosition -= $iAmount;
426426
}
427427

428428
/**

0 commit comments

Comments
 (0)