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/PostgreSqlPlatform.php 1 location

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

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

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

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

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