@@ -49,7 +49,7 @@ class ParserState
49
49
/**
50
50
* @var int
51
51
*/
52
- private $ iLength ;
52
+ private $ length ;
53
53
54
54
/**
55
55
* @var int
@@ -78,7 +78,7 @@ public function setCharset($charset): void
78
78
$ this ->charset = $ charset ;
79
79
$ this ->characters = $ this ->strsplit ($ this ->text );
80
80
if (\is_array ($ this ->characters )) {
81
- $ this ->iLength = \count ($ this ->characters );
81
+ $ this ->length = \count ($ this ->characters );
82
82
}
83
83
}
84
84
@@ -233,7 +233,7 @@ public function consumeWhiteSpace(): array
233
233
try {
234
234
$ oComment = $ this ->consumeComment ();
235
235
} catch (UnexpectedEOFException $ e ) {
236
- $ this ->currentPosition = $ this ->iLength ;
236
+ $ this ->currentPosition = $ this ->length ;
237
237
return $ comments ;
238
238
}
239
239
} else {
@@ -259,16 +259,16 @@ public function comes($sString, $bCaseInsensitive = false): bool
259
259
}
260
260
261
261
/**
262
- * @param int $iLength
262
+ * @param int $length
263
263
* @param int $iOffset
264
264
*/
265
- public function peek ($ iLength = 1 , $ iOffset = 0 ): string
265
+ public function peek ($ length = 1 , $ iOffset = 0 ): string
266
266
{
267
267
$ iOffset += $ this ->currentPosition ;
268
- if ($ iOffset >= $ this ->iLength ) {
268
+ if ($ iOffset >= $ this ->length ) {
269
269
return '' ;
270
270
}
271
- return $ this ->substr ($ iOffset , $ iLength );
271
+ return $ this ->substr ($ iOffset , $ length );
272
272
}
273
273
274
274
/**
@@ -281,11 +281,11 @@ public function consume($mValue = 1): string
281
281
{
282
282
if (\is_string ($ mValue )) {
283
283
$ iLineCount = \substr_count ($ mValue , "\n" );
284
- $ iLength = $ this ->strlen ($ mValue );
285
- if (!$ this ->streql ($ this ->substr ($ this ->currentPosition , $ iLength ), $ mValue )) {
284
+ $ length = $ this ->strlen ($ mValue );
285
+ if (!$ this ->streql ($ this ->substr ($ this ->currentPosition , $ length ), $ mValue )) {
286
286
throw new UnexpectedTokenException (
287
287
$ mValue ,
288
- $ this ->peek (\max ($ iLength , 5 )),
288
+ $ this ->peek (\max ($ length , 5 )),
289
289
'literal ' ,
290
290
$ this ->lineNumber
291
291
);
@@ -294,7 +294,7 @@ public function consume($mValue = 1): string
294
294
$ this ->currentPosition += $ this ->strlen ($ mValue );
295
295
return $ mValue ;
296
296
} else {
297
- if ($ this ->currentPosition + $ mValue > $ this ->iLength ) {
297
+ if ($ this ->currentPosition + $ mValue > $ this ->length ) {
298
298
throw new UnexpectedEOFException ((string ) $ mValue , $ this ->peek (5 ), 'count ' , $ this ->lineNumber );
299
299
}
300
300
$ result = $ this ->substr ($ this ->currentPosition , $ mValue );
@@ -351,7 +351,7 @@ public function consumeComment()
351
351
352
352
public function isEnd (): bool
353
353
{
354
- return $ this ->currentPosition >= $ this ->iLength ;
354
+ return $ this ->currentPosition >= $ this ->length ;
355
355
}
356
356
357
357
/**
@@ -439,21 +439,21 @@ public function strlen($sString): int
439
439
440
440
/**
441
441
* @param int $iStart
442
- * @param int $iLength
442
+ * @param int $length
443
443
*/
444
- private function substr ($ iStart , $ iLength ): string
444
+ private function substr ($ iStart , $ length ): string
445
445
{
446
- if ($ iLength < 0 ) {
447
- $ iLength = $ this ->iLength - $ iStart + $ iLength ;
446
+ if ($ length < 0 ) {
447
+ $ length = $ this ->length - $ iStart + $ length ;
448
448
}
449
- if ($ iStart + $ iLength > $ this ->iLength ) {
450
- $ iLength = $ this ->iLength - $ iStart ;
449
+ if ($ iStart + $ length > $ this ->length ) {
450
+ $ length = $ this ->length - $ iStart ;
451
451
}
452
452
$ result = '' ;
453
- while ($ iLength > 0 ) {
453
+ while ($ length > 0 ) {
454
454
$ result .= $ this ->characters [$ iStart ];
455
455
$ iStart ++;
456
- $ iLength --;
456
+ $ length --;
457
457
}
458
458
return $ result ;
459
459
}
@@ -481,9 +481,9 @@ private function strsplit($sString)
481
481
if ($ this ->streql ($ this ->charset , 'utf-8 ' )) {
482
482
return \preg_split ('//u ' , $ sString , -1 , PREG_SPLIT_NO_EMPTY );
483
483
} else {
484
- $ iLength = \mb_strlen ($ sString , $ this ->charset );
484
+ $ length = \mb_strlen ($ sString , $ this ->charset );
485
485
$ result = [];
486
- for ($ i = 0 ; $ i < $ iLength ; ++$ i ) {
486
+ for ($ i = 0 ; $ i < $ length ; ++$ i ) {
487
487
$ result [] = \mb_substr ($ sString , $ i , 1 , $ this ->charset );
488
488
}
489
489
return $ result ;
0 commit comments