Code Duplication    Length = 8-8 lines in 5 locations

lib/Doctrine/DBAL/Platforms/AbstractPlatform.php 1 location

@@ 892-899 (lines=8) @@
889
     *
890
     * @return string
891
     */
892
    public function getSubstringExpression($value, $from, $length = null)
893
    {
894
        if ($length === null) {
895
            return 'SUBSTRING(' . $value . ' FROM ' . $from . ')';
896
        }
897
898
        return 'SUBSTRING(' . $value . ' FROM ' . $from . ' FOR ' . $length . ')';
899
    }
900
901
    /**
902
     * Returns a SQL snippet to concatenate the given expressions.

lib/Doctrine/DBAL/Platforms/DB2Platform.php 1 location

@@ 811-818 (lines=8) @@
808
    /**
809
     * {@inheritDoc}
810
     */
811
    public function getSubstringExpression($value, $from, $length = null)
812
    {
813
        if ($length === null) {
814
            return 'SUBSTR(' . $value . ', ' . $from . ')';
815
        }
816
817
        return 'SUBSTR(' . $value . ', ' . $from . ', ' . $length . ')';
818
    }
819
820
    /**
821
     * {@inheritDoc}

lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php 1 location

@@ 1070-1077 (lines=8) @@
1067
    /**
1068
     * {@inheritdoc}
1069
     */
1070
    public function getSubstringExpression($value, $from, $length = null)
1071
    {
1072
        if (null === $length) {
1073
            return 'SUBSTRING(' . $value . ', ' . $from . ')';
1074
        }
1075
1076
        return 'SUBSTRING(' . $value . ', ' . $from . ', ' . $length . ')';
1077
    }
1078
1079
    /**
1080
     * {@inheritdoc}

lib/Doctrine/DBAL/Platforms/SqlitePlatform.php 1 location

@@ 107-114 (lines=8) @@
104
     *
105
     * SQLite only supports the 2 parameter variant of this function
106
     */
107
    public function getSubstringExpression($value, $position, $length = null)
108
    {
109
        if ($length !== null) {
110
            return 'SUBSTR(' . $value . ', ' . $position . ', ' . $length . ')';
111
        }
112
113
        return 'SUBSTR(' . $value . ', ' . $position . ', LENGTH(' . $value . '))';
114
    }
115
116
    /**
117
     * {@inheritDoc}

lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php 1 location

@@ 87-94 (lines=8) @@
84
    /**
85
     * {@inheritDoc}
86
     */
87
    public function getSubstringExpression($value, $from, $length = null)
88
    {
89
        if ($length === null) {
90
            return 'SUBSTRING(' . $value . ' FROM ' . $from . ')';
91
        }
92
93
        return 'SUBSTRING(' . $value . ' FROM ' . $from . ' FOR ' . $length . ')';
94
    }
95
96
    /**
97
     * {@inheritDoc}