Code Duplication    Length = 9-9 lines in 4 locations

class/oledrion_utils.php 2 locations

@@ 1779-1787 (lines=9) @@
1776
     * @param  string $separator Le séparateur
1777
     * @return string
1778
     */
1779
    public function getId($string, $separator = '_')
1780
    {
1781
        $pos = strrpos($string, $separator);
1782
        if ($pos === false) {
1783
            return $string;
1784
        } else {
1785
            return (int)substr($string, $pos + 1);
1786
        }
1787
    }
1788
1789
    /**
1790
     * Fonction "inverse" de getId (depuis xxxx-99 on récupère xxxx)
@@ 1797-1805 (lines=9) @@
1794
     * @param  string $separator Le séparateur
1795
     * @return string
1796
     */
1797
    public function getName($string, $separator = '_')
1798
    {
1799
        $pos = strrpos($string, $separator);
1800
        if ($pos === false) {
1801
            return $string;
1802
        } else {
1803
            return substr($string, 0, $pos);
1804
        }
1805
    }
1806
1807
    /**
1808
     * Renvoie un montant nul si le montant est négatif

class/utility.php 2 locations

@@ 1922-1930 (lines=9) @@
1919
     * @param  string $separator Le séparateur
1920
     * @return string
1921
     */
1922
    public static function getId($string, $separator = '_')
1923
    {
1924
        $pos = strrpos($string, $separator);
1925
        if ($pos === false) {
1926
            return $string;
1927
        } else {
1928
            return (int)substr($string, $pos + 1);
1929
        }
1930
    }
1931
1932
    /**
1933
     * Fonction "inverse" de getId (depuis xxxx-99 on récupère xxxx)
@@ 1940-1948 (lines=9) @@
1937
     * @param  string $separator Le séparateur
1938
     * @return string
1939
     */
1940
    public static function getName($string, $separator = '_')
1941
    {
1942
        $pos = strrpos($string, $separator);
1943
        if ($pos === false) {
1944
            return $string;
1945
        } else {
1946
            return substr($string, 0, $pos);
1947
        }
1948
    }
1949
1950
    /**
1951
     * Renvoie un montant nul si le montant est négatif