Yet more docblock fixes

This commit is contained in:
Mark Baker 2013-04-28 16:02:46 +01:00
parent d4e7026c95
commit 91eb758a6d
2 changed files with 67 additions and 19 deletions

View File

@ -2356,7 +2356,6 @@ class PHPExcel_Calculation_Engineering {
* Returns an array of units of measure, for a specified conversion group, or for all groups * Returns an array of units of measure, for a specified conversion group, or for all groups
* *
* @param string $group The group whose units of measure you want to retrieve * @param string $group The group whose units of measure you want to retrieve
*
* @return array * @return array
*/ */
public static function getConversionGroupUnits($group = NULL) { public static function getConversionGroupUnits($group = NULL) {
@ -2373,6 +2372,7 @@ class PHPExcel_Calculation_Engineering {
/** /**
* getConversionGroupUnitDetails * getConversionGroupUnitDetails
* *
* @param string $group The group whose units of measure you want to retrieve
* @return array * @return array
*/ */
public static function getConversionGroupUnitDetails($group = NULL) { public static function getConversionGroupUnitDetails($group = NULL) {

View File

@ -1206,13 +1206,22 @@ class PHPExcel_Calculation_Financial {
/** /**
* FVSCHEDULE * FVSCHEDULE
* *
* Returns the future value of an initial principal after applying a series of compound interest rates.
* Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate.
*
* Excel Function:
* FVSCHEDULE(principal,schedule)
*
* @param float $principal The present value.
* @param float[] $schedule An array of interest rates to apply.
* @return float
*/ */
public static function FVSCHEDULE($principal, $schedule) { public static function FVSCHEDULE($principal, $schedule) {
$principal = PHPExcel_Calculation_Functions::flattenSingleValue($principal); $principal = PHPExcel_Calculation_Functions::flattenSingleValue($principal);
$schedule = PHPExcel_Calculation_Functions::flattenArray($schedule); $schedule = PHPExcel_Calculation_Functions::flattenArray($schedule);
foreach($schedule as $n) { foreach($schedule as $rate) {
$principal *= 1 + $n; $principal *= 1 + $rate;
} }
return $principal; return $principal;
@ -1227,13 +1236,13 @@ class PHPExcel_Calculation_Financial {
* Excel Function: * Excel Function:
* INTRATE(settlement,maturity,investment,redemption[,basis]) * INTRATE(settlement,maturity,investment,redemption[,basis])
* *
* @param mixed settlement The security's settlement date. * @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue date when the security is traded to the buyer. * The security 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. * @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires. * The maturity date is the date when the security expires.
* @param integer investment The amount invested in the security. * @param integer $investment The amount invested in the security.
* @param integer redemption The amount to be received at maturity. * @param integer $redemption The amount to be received at maturity.
* @param integer basis The type of day count to use. * @param integer $basis The type of day count to use.
* 0 or omitted US (NASD) 30/360 * 0 or omitted US (NASD) 30/360
* 1 Actual/actual * 1 Actual/actual
* 2 Actual/360 * 2 Actual/360
@ -1273,6 +1282,9 @@ class PHPExcel_Calculation_Financial {
* *
* Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.
* *
* Excel Function:
* IPMT(rate,per,nper,pv[,fv][,type])
*
* @param float $rate Interest rate per period * @param float $rate Interest rate per period
* @param int $per Period for which we want to find the interest * @param int $per Period for which we want to find the interest
* @param int $nper Number of periods * @param int $nper Number of periods
@ -1302,7 +1314,25 @@ class PHPExcel_Calculation_Financial {
return $interestAndPrincipal[0]; return $interestAndPrincipal[0];
} // function IPMT() } // function IPMT()
/**
* IRR
*
* Returns the internal rate of return for a series of cash flows represented by the numbers in values.
* These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur
* at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received
* for an investment consisting of payments (negative values) and income (positive values) that occur at regular
* periods.
*
* Excel Function:
* IRR(values[,guess])
*
* @param float[] $values An array or a reference to cells that contain numbers for which you want
* to calculate the internal rate of return.
* Values must contain at least one positive value and one negative value to
* calculate the internal rate of return.
* @param float $guess A number that you guess is close to the result of IRR
* @return float
*/
public static function IRR($values, $guess = 0.1) { public static function IRR($values, $guess = 0.1) {
if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE(); if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
$values = PHPExcel_Calculation_Functions::flattenArray($values); $values = PHPExcel_Calculation_Functions::flattenArray($values);
@ -1336,28 +1366,30 @@ class PHPExcel_Calculation_Financial {
$dx *= 0.5; $dx *= 0.5;
$x_mid = $rtb + $dx; $x_mid = $rtb + $dx;
$f_mid = self::NPV($x_mid, $values); $f_mid = self::NPV($x_mid, $values);
if ($f_mid <= 0.0) $rtb = $x_mid; if ($f_mid <= 0.0)
if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid; $rtb = $x_mid;
if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION))
return $x_mid;
} }
return PHPExcel_Calculation_Functions::VALUE(); return PHPExcel_Calculation_Functions::VALUE();
} // function IRR() } // function IRR()
/** /**
* ISPMT * ISPMT
* *
* Returns the interest payment for an investment based on an interest rate and a constant payment schedule. * Returns the interest payment for an investment based on an interest rate and a constant payment schedule.
* *
* Excel Function: * Excel Function:
* =ISPMT(interest_rate, period, number_payments, PV) * =ISPMT(interest_rate, period, number_payments, PV)
* *
* interest_rate is the interest rate for the investment * interest_rate is the interest rate for the investment
* *
* period is the period to calculate the interest rate. It must be betweeen 1 and number_payments. * period is the period to calculate the interest rate. It must be betweeen 1 and number_payments.
* *
* number_payments is the number of payments for the annuity * number_payments is the number of payments for the annuity
* *
* PV is the loan amount or present value of the payments * PV is the loan amount or present value of the payments
*/ */
public static function ISPMT() { public static function ISPMT() {
// Return value // Return value
@ -1384,6 +1416,22 @@ class PHPExcel_Calculation_Financial {
} // function ISPMT() } // function ISPMT()
/**
* MIRR
*
* Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both
* the cost of the investment and the interest received on reinvestment of cash.
*
* Excel Function:
* MIRR(values,finance_rate, reinvestment_rate)
*
* @param float[] $values An array or a reference to cells that contain a series of payments and
* income occurring at regular intervals.
* Payments are negative value, income is positive values.
* @param float $finance_rate The interest rate you pay on the money used in the cash flows
* @param float $reinvestment_rate The interest rate you receive on the cash flows as you reinvest them
* @return float
*/
public static function MIRR($values, $finance_rate, $reinvestment_rate) { public static function MIRR($values, $finance_rate, $reinvestment_rate) {
if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE(); if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
$values = PHPExcel_Calculation_Functions::flattenArray($values); $values = PHPExcel_Calculation_Functions::flattenArray($values);