diff options
Diffstat (limited to 'src/Utils/BufferedQuery.php')
-rw-r--r-- | src/Utils/BufferedQuery.php | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/src/Utils/BufferedQuery.php b/src/Utils/BufferedQuery.php index b333fa3..ee0dca4 100644 --- a/src/Utils/BufferedQuery.php +++ b/src/Utils/BufferedQuery.php @@ -191,7 +191,7 @@ class BufferedQuery * treated differently, because of the preceding backslash, it will * be ignored. */ - if ((($this->status & static::STATUS_COMMENT) == 0) && ($this->query[$i] === '\\')) { + if ((($this->status & static::STATUS_COMMENT) === 0) && ($this->query[$i] === '\\')) { $this->current .= $this->query[$i] . $this->query[++$i]; continue; } @@ -261,22 +261,21 @@ class BufferedQuery $this->status = static::STATUS_COMMENT_BASH; $this->current .= $this->query[$i]; continue; - } elseif (($i + 2 < $len) - && ($this->query[$i] === '-') - && ($this->query[$i + 1] === '-') - && (Context::isWhitespace($this->query[$i + 2])) - ) { - $this->status = static::STATUS_COMMENT_SQL; - $this->current .= $this->query[$i]; - continue; - } elseif (($i + 2 < $len) - && ($this->query[$i] === '/') - && ($this->query[$i + 1] === '*') - && ($this->query[$i + 2] !== '!') - ) { - $this->status = static::STATUS_COMMENT_C; - $this->current .= $this->query[$i]; - continue; + } elseif ($i + 2 < $len) { + if (($this->query[$i] === '-') + && ($this->query[$i + 1] === '-') + && Context::isWhitespace($this->query[$i + 2])) { + $this->status = static::STATUS_COMMENT_SQL; + $this->current .= $this->query[$i]; + continue; + } + elseif (($this->query[$i] === '/') + && ($this->query[$i + 1] === '*') + && ($this->query[$i + 2] !== '!')) { + $this->status = static::STATUS_COMMENT_C; + $this->current .= $this->query[$i]; + continue; + } } /* @@ -301,7 +300,7 @@ class BufferedQuery && (($this->query[$i + 6] === 'T') || ($this->query[$i + 6] === 't')) && (($this->query[$i + 7] === 'E') || ($this->query[$i + 7] === 'e')) && (($this->query[$i + 8] === 'R') || ($this->query[$i + 8] === 'r')) - && (Context::isWhitespace($this->query[$i + 9])) + && Context::isWhitespace($this->query[$i + 9]) ) { // Saving the current index to be able to revert any parsing // done in this block. @@ -309,7 +308,7 @@ class BufferedQuery $i += 9; // Skipping `DELIMITER`. // Skipping whitespaces. - while (($i < $len) && (Context::isWhitespace($this->query[$i]))) { + while (($i < $len) && Context::isWhitespace($this->query[$i])) { ++$i; } @@ -320,9 +319,9 @@ class BufferedQuery } // Checking if the delimiter definition ended. - if (($delimiter != '') - && ((($i < $len) && (Context::isWhitespace($this->query[$i]))) - || (($i === $len) && ($end))) + if (($delimiter !== '') + && ((($i < $len) && Context::isWhitespace($this->query[$i])) + || (($i === $len) && $end)) ) { // Saving the delimiter. $this->setDelimiter($delimiter); @@ -393,7 +392,7 @@ class BufferedQuery $this->current .= $this->query[$i]; } - if (($end) && ($i === $len)) { + if ($end && ($i === $len)) { // If the end of the buffer was reached, the buffer is emptied and // the current statement that was extracted is returned. $ret = $this->current; |