Code Duplication    Length = 6-7 lines in 4 locations

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

@@ 888-894 (lines=7) @@
885
        if (!$previous || !isset($previous[self::TOKEN_VALUE]) || $previous[self::TOKEN_VALUE] !== '.') {
886
            $upper = strtoupper($string);
887
            // Top Level Reserved Word
888
            if (preg_match('/^(' . self::$regex_reserved_toplevel . ')($|\s|' . self::$regex_boundaries . ')/', $upper,
889
                $matches)) {
890
                return array(
891
                    self::TOKEN_TYPE  => self::TOKEN_TYPE_RESERVED_TOPLEVEL,
892
                    self::TOKEN_VALUE => substr($string, 0, strlen($matches[1]))
893
                );
894
            }
895
            // Newline Reserved Word
896
            if (preg_match('/^(' . self::$regex_reserved_newline . ')($|\s|' . self::$regex_boundaries . ')/', $upper,
897
                $matches)) {
@@ 896-902 (lines=7) @@
893
                );
894
            }
895
            // Newline Reserved Word
896
            if (preg_match('/^(' . self::$regex_reserved_newline . ')($|\s|' . self::$regex_boundaries . ')/', $upper,
897
                $matches)) {
898
                return array(
899
                    self::TOKEN_TYPE  => self::TOKEN_TYPE_RESERVED_NEWLINE,
900
                    self::TOKEN_VALUE => substr($string, 0, strlen($matches[1]))
901
                );
902
            }
903
            // Other Reserved Word
904
            if (preg_match('/^(' . self::$regex_reserved . ')($|\s|' . self::$regex_boundaries . ')/', $upper,
905
                $matches)) {
@@ 904-910 (lines=7) @@
901
                );
902
            }
903
            // Other Reserved Word
904
            if (preg_match('/^(' . self::$regex_reserved . ')($|\s|' . self::$regex_boundaries . ')/', $upper,
905
                $matches)) {
906
                return array(
907
                    self::TOKEN_TYPE  => self::TOKEN_TYPE_RESERVED,
908
                    self::TOKEN_VALUE => substr($string, 0, strlen($matches[1]))
909
                );
910
            }
911
        }
912
913
        // A function must be suceeded by '('
@@ 917-922 (lines=6) @@
914
        // this makes it so "count(" is considered a function, but "count" alone is not
915
        $upper = strtoupper($string);
916
        // function
917
        if (preg_match('/^(' . self::$regex_function . '[(]|\s|[)])/', $upper, $matches)) {
918
            return array(
919
                self::TOKEN_TYPE  => self::TOKEN_TYPE_RESERVED,
920
                self::TOKEN_VALUE => substr($string, 0, strlen($matches[1]) - 1)
921
            );
922
        }
923
924
        // Non reserved word
925
        preg_match('/^(.*?)($|\s|["\'`]|' . self::$regex_boundaries . ')/', $string, $matches);