Code Duplication    Length = 6-7 lines in 3 locations

core/src/Support/Formatter/SqlFormatter.php 3 locations

@@ 804-809 (lines=6) @@
801
    protected static function getNextToken($string, $previous = null)
802
    {
803
        // Whitespace
804
        if (preg_match('/^\s+/', $string, $matches)) {
805
            return array(
806
                self::TOKEN_VALUE => $matches[0],
807
                self::TOKEN_TYPE  => self::TOKEN_TYPE_WHITESPACE
808
            );
809
        }
810
811
        // Comment
812
        if ($string[0] === '#' || (isset($string[1]) && ($string[0] === '-' && $string[1] === '-') || ($string[0] === '/' && $string[1] === '*'))) {
@@ 867-873 (lines=7) @@
864
        }
865
866
        // Number (decimal, binary, or hex)
867
        if (preg_match('/^([0-9]+(\.[0-9]+)?|0x[0-9a-fA-F]+|0b[01]+)($|\s|"\'`|' . self::$regex_boundaries . ')/',
868
            $string, $matches)) {
869
            return array(
870
                self::TOKEN_VALUE => $matches[1],
871
                self::TOKEN_TYPE  => self::TOKEN_TYPE_NUMBER
872
            );
873
        }
874
875
        // Boundary Character (punctuation and symbols)
876
        if (preg_match('/^(' . self::$regex_boundaries . ')/', $string, $matches)) {
@@ 876-881 (lines=6) @@
873
        }
874
875
        // Boundary Character (punctuation and symbols)
876
        if (preg_match('/^(' . self::$regex_boundaries . ')/', $string, $matches)) {
877
            return array(
878
                self::TOKEN_VALUE => $matches[1],
879
                self::TOKEN_TYPE  => self::TOKEN_TYPE_BOUNDARY
880
            );
881
        }
882
883
        // A reserved word cannot be preceded by a '.'
884
        // this makes it so in "mytable.from", "from" is not considered a reserved word