Skip to content

Commit 5bfe3df

Browse files
committed
Save a bunch of is_string() calls by ensuring proper input to peek()
1 parent 229f96e commit 5bfe3df

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lib/Sabberworm/CSS/Parser.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -457,19 +457,13 @@ private static function identifierIs($sIdentifier, $sMatch, $bCaseInsensitive =
457457
}
458458

459459
private function comes($sString, $alpha = false) {
460-
$sPeek = $this->peek($alpha ? $sString : strlen($sString));
460+
$sPeek = $this->peek($alpha ? $this->strlen($sString) : strlen($sString));
461461
return ($sPeek == '')
462462
? false
463463
: $this->streql($sPeek, $sString, $alpha);
464464
}
465465

466466
private function peek($iLength = 1, $iOffset = 0) {
467-
if (is_string($iLength)) {
468-
$iLength = $this->strlen($iLength);
469-
}
470-
if (is_string($iOffset)) {
471-
$iOffset = $this->strlen($iOffset);
472-
}
473467
if (($peek = (!$iOffset && ($iLength === 1))) &&
474468
!is_null($this->peekCache)) {
475469
return $this->peekCache;

0 commit comments

Comments
 (0)