Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial.php
public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0)
    {
        $settlement = Functions::flattenSingleValue($settlement);
        $maturity = Functions::flattenSingleValue($maturity);
        $issue = Functions::flattenSingleValue($issue);
        $rate = Functions::flattenSingleValue($rate);
        $price = Functions::flattenSingleValue($price);
        $basis = (int) Functions::flattenSingleValue($basis);

        //    Validate
        if (is_numeric($rate) && is_numeric($price)) {
            if (($rate <= 0) || ($price <= 0)) {
                return Functions::NAN();
            }
            $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis);
            if (!is_numeric($daysPerYear)) {
                return $daysPerYear;
            }
            $daysBetweenIssueAndSettlement = DateTime::YEARFRAC($issue, $settlement, $basis);
            if (!is_numeric($daysBetweenIssueAndSettlement)) {
                //    return date error
                return $daysBetweenIssueAndSettlement;
            }
            $daysBetweenIssueAndSettlement *= $daysPerYear;
            $daysBetweenIssueAndMaturity = DateTime::YEARFRAC($issue, $maturity, $basis);
            if (!is_numeric($daysBetweenIssueAndMaturity)) {
                //    return date error
                return $daysBetweenIssueAndMaturity;
            }
            $daysBetweenIssueAndMaturity *= $daysPerYear;
            $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis);
            if (!is_numeric($daysBetweenSettlementAndMaturity)) {
                //    return date error
                return $daysBetweenSettlementAndMaturity;
            }
            $daysBetweenSettlementAndMaturity *= $daysPerYear;

            return ((1 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate) - (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) /
                   (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) *
                   ($daysPerYear / $daysBetweenSettlementAndMaturity);
        }

        return Functions::VALUE();
    }
public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0)
    {
        $settlement = Functions::flattenSingleValue($settlement);
        $maturity = Functions::flattenSingleValue($maturity);
        $issue = Functions::flattenSingleValue($issue);
        $rate = Functions::flattenSingleValue($rate);
        $price = Functions::flattenSingleValue($price);
        $basis = (int) Functions::flattenSingleValue($basis);

        //    Validate
        if (is_numeric($rate) && is_numeric($price)) {
            if (($rate <= 0) || ($price <= 0)) {
                return Functions::NAN();
            }
            $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis);
            if (!is_numeric($daysPerYear)) {
                return $daysPerYear;
            }
            $daysBetweenIssueAndSettlement = DateTime::YEARFRAC($issue, $settlement, $basis);
            if (!is_numeric($daysBetweenIssueAndSettlement)) {
                //    return date error
                return $daysBetweenIssueAndSettlement;
            }
            $daysBetweenIssueAndSettlement *= $daysPerYear;
            $daysBetweenIssueAndMaturity = DateTime::YEARFRAC($issue, $maturity, $basis);
            if (!is_numeric($daysBetweenIssueAndMaturity)) {
                //    return date error
                return $daysBetweenIssueAndMaturity;
            }
            $daysBetweenIssueAndMaturity *= $daysPerYear;
            $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis);
            if (!is_numeric($daysBetweenSettlementAndMaturity)) {
                //    return date error
                return $daysBetweenSettlementAndMaturity;
            }
            $daysBetweenSettlementAndMaturity *= $daysPerYear;

            return ((1 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate) - (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) /
                   (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) *
                   ($daysPerYear / $daysBetweenSettlementAndMaturity);
        }

        return Functions::VALUE();
    }
public static function YIELDMAT ( $ settlement , $ maturity , $ issue , $ rate , $ price , $ basis = 0 ) { $ settlement = Functions :: flattenSingleValue ( $ settlement ) ; $ maturity = Functions :: flattenSingleValue ( $ maturity ) ; $ issue = Functions :: flattenSingleValue ( $ issue ) ; $ rate = Functions :: flattenSingleValue ( $ rate ) ; $ price = Functions :: flattenSingleValue ( $ price ) ; $ basis = ( int ) Functions :: flattenSingleValue ( $ basis ) ; //    Validate if ( is_numeric ( $ rate ) && is_numeric ( $ price ) ) { if ( ( $ rate <= 0 ) || ( $ price <= 0 ) ) { return Functions :: NAN ( ) ; } $ daysPerYear = self :: daysPerYear ( DateTime :: YEAR ( $ settlement ) , $ basis ) ; if ( ! is_numeric ( $ daysPerYear ) ) { return $ daysPerYear ; } $ daysBetweenIssueAndSettlement = DateTime :: YEARFRAC ( $ issue , $ settlement , $ basis ) ; if ( ! is_numeric ( $ daysBetweenIssueAndSettlement ) ) { //    return date error return $ daysBetweenIssueAndSettlement ; } $ daysBetweenIssueAndSettlement *= $ daysPerYear ; $ daysBetweenIssueAndMaturity = DateTime :: YEARFRAC ( $ issue , $ maturity , $ basis ) ; if ( ! is_numeric ( $ daysBetweenIssueAndMaturity ) ) { //    return date error return $ daysBetweenIssueAndMaturity ; } $ daysBetweenIssueAndMaturity *= $ daysPerYear ; $ daysBetweenSettlementAndMaturity = DateTime :: YEARFRAC ( $ settlement , $ maturity , $ basis ) ; if ( ! is_numeric ( $ daysBetweenSettlementAndMaturity ) ) { //    return date error return $ daysBetweenSettlementAndMaturity ; } $ daysBetweenSettlementAndMaturity *= $ daysPerYear ; return ( ( 1 + ( ( $ daysBetweenIssueAndMaturity / $ daysPerYear ) * $ rate ) - ( ( $ price / 100 ) + ( ( $ daysBetweenIssueAndSettlement / $ daysPerYear ) * $ rate ) ) ) / ( ( $ price / 100 ) + ( ( $ daysBetweenIssueAndSettlement / $ daysPerYear ) * $ rate ) ) ) * ( $ daysPerYear / $ daysBetweenSettlementAndMaturity ) ; } return Functions :: VALUE ( ) ; }
YIELDMAT.

Returns the annual yield of a security that pays interest at maturity.

@param mixed $settlement The security's settlement date.
The security's settlement date is the date after the issue date when the security is traded to the buyer.
@param mixed $maturity The security's maturity date.
The maturity date is the date when the security expires.
@param mixed $issue The security's issue date
@param int $rate The security's interest rate at date of issue
@param int $price The security's price per $100 face value
@param int $basis The type of day count to use.
0 or omitted    US (NASD) 30/360
1                Actual/actual
2                Actual/360
3                Actual/365
4                European 30/360

@return float
YIELDMAT .