SqlParser\Lexer::__construct PHP Метод

__construct() публичный Метод

Constructor.
public __construct ( string | UtfString $str, boolean $strict = false, string $delimiter = null )
$str string | UtfString The query to be lexed.
$strict boolean Whether strict mode should be enabled or not.
$delimiter string The delimiter to be used.
    public function __construct($str, $strict = false, $delimiter = null)
    {
        // `strlen` is used instead of `mb_strlen` because the lexer needs to
        // parse each byte of the input.
        $len = $str instanceof UtfString ? $str->length() : strlen($str);
        // For multi-byte strings, a new instance of `UtfString` is
        // initialized (only if `UtfString` usage is forced.
        if (!$str instanceof UtfString) {
            if (USE_UTF_STRINGS && $len !== mb_strlen($str, 'UTF-8')) {
                $str = new UtfString($str);
            }
        }
        $this->str = $str;
        $this->len = $str instanceof UtfString ? $str->length() : $len;
        $this->strict = $strict;
        // Setting the delimiter.
        $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$DEFAULT_DELIMITER);
        $this->lex();
    }