Code Duplication    Length = 16-18 lines in 2 locations

src/PhpSpreadsheet/Calculation/Engineering.php 2 locations

@@ 1949-1966 (lines=18) @@
1946
     * @param    string $complexNumber The complex number for which you want the cosine.
1947
     * @return    string|float
1948
     */
1949
    public static function IMCOS($complexNumber)
1950
    {
1951
        $complexNumber = Functions::flattenSingleValue($complexNumber);
1952
1953
        $parsedComplex = self::parseComplex($complexNumber);
1954
1955
        if ($parsedComplex['imaginary'] == 0.0) {
1956
            return cos($parsedComplex['real']);
1957
        } else {
1958
            return self::IMCONJUGATE(
1959
                self::COMPLEX(
1960
                    cos($parsedComplex['real']) * cosh($parsedComplex['imaginary']),
1961
                    sin($parsedComplex['real']) * sinh($parsedComplex['imaginary']),
1962
                    $parsedComplex['suffix']
1963
                )
1964
            );
1965
        }
1966
    }
1967
1968
1969
    /**
@@ 1980-1995 (lines=16) @@
1977
     * @param    string $complexNumber The complex number for which you want the sine.
1978
     * @return    string|float
1979
     */
1980
    public static function IMSIN($complexNumber)
1981
    {
1982
        $complexNumber = Functions::flattenSingleValue($complexNumber);
1983
1984
        $parsedComplex = self::parseComplex($complexNumber);
1985
1986
        if ($parsedComplex['imaginary'] == 0.0) {
1987
            return sin($parsedComplex['real']);
1988
        } else {
1989
            return self::COMPLEX(
1990
                sin($parsedComplex['real']) * cosh($parsedComplex['imaginary']),
1991
                cos($parsedComplex['real']) * sinh($parsedComplex['imaginary']),
1992
                $parsedComplex['suffix']
1993
            );
1994
        }
1995
    }
1996
1997
1998
    /**