Skip to content

Commit

Permalink
chore(support): we still have php5 here :)
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Jun 21, 2018
1 parent 1b532e1 commit c18b0c3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public function strip($json)
list($index, $return, $char) = [-1, '', ''];

while (isset($json[++$index])) {
list($prev, $char, $charnext) = [$char, $json[$index], $json[$index] . ($json[$index + 1] ?? '')];
list($prev, $char) = [$char, $json[$index]];

$charnext = $char . (isset($json[$index + 1]) ? $json[$index + 1] : '');
if ($this->inStringOrCommentEnd($prev, $char, $charnext)) {
$return .= $char;

Expand All @@ -50,7 +51,7 @@ public function strip($json)
return $return;
}

protected function inStringOrCommentEnd(string $prev, string $char, string $charnext): bool
protected function inStringOrCommentEnd($prev, $char, $charnext)
{
if (0 === $this->comment && $char === '"' && $prev !== '\\') {
$this->inStr = !$this->inStr;
Expand All @@ -63,7 +64,7 @@ protected function inStringOrCommentEnd(string $prev, string $char, string $char
return $this->inStr || 0 === $this->comment;
}

protected function hasCommentEnded(string $char, string $charnext): bool
protected function hasCommentEnded($char, $charnext)
{
$singleEnded = $this->comment === 1 && $char == "\n";
$multiEnded = $this->comment === 2 && $charnext == '*/';
Expand Down

0 comments on commit c18b0c3

Please sign in to comment.