diff --git a/classes/src/Calculation/DateTime.php b/classes/src/Calculation/DateTime.php
index 6d163cf1..6e01f9e1 100644
--- a/classes/src/Calculation/DateTime.php
+++ b/classes/src/Calculation/DateTime.php
@@ -530,16 +530,16 @@ class DateTime
$testVal3 = strftime('%Y');
}
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$PHPDateArray = date_parse($testVal1.'-'.$testVal2.'-'.$testVal3);
if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) {
$PHPDateArray = date_parse($testVal2.'-'.$testVal1.'-'.$testVal3);
if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
}
@@ -550,7 +550,7 @@ class DateTime
$PHPDateArray['year'] = strftime('%Y');
}
if ($PHPDateArray['year'] < 1900) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if ($PHPDateArray['month'] == '') {
$PHPDateArray['month'] = strftime('%m');
@@ -569,16 +569,16 @@ class DateTime
)
);
- switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
- case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
+ switch (Functions::getReturnDateType()) {
+ case Functions::RETURNDATE_EXCEL:
return (float) $excelDateValue;
- case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
+ case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateValue);
- case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
+ case Functions::RETURNDATE_PHP_OBJECT:
return new DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00');
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -606,12 +606,12 @@ class DateTime
*/
public static function TIMEVALUE($timeValue)
{
- $timeValue = trim(PHPExcel_Calculation_Functions::flattenSingleValue($timeValue), '"');
+ $timeValue = trim(Functions::flattenSingleValue($timeValue), '"');
$timeValue = str_replace(array('/', '.'), array('-', '-'), $timeValue);
$PHPDateArray = date_parse($timeValue);
if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel(
$PHPDateArray['year'],
$PHPDateArray['month'],
@@ -624,16 +624,16 @@ class DateTime
$excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1;
}
- switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
- case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
+ switch (Functions::getReturnDateType()) {
+ case Functions::RETURNDATE_EXCEL:
return (float) $excelDateValue;
- case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
+ case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) $phpDateValue = PHPExcel_Shared_Date::ExcelToPHP($excelDateValue+25569) - 3600;
- case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
+ case Functions::RETURNDATE_PHP_OBJECT:
return new DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']);
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -649,20 +649,20 @@ class DateTime
*/
public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D')
{
- $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
- $endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
- $unit = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($unit));
+ $startDate = Functions::flattenSingleValue($startDate);
+ $endDate = Functions::flattenSingleValue($endDate);
+ $unit = strtoupper(Functions::flattenSingleValue($unit));
if (is_string($startDate = self::getDateValue($startDate))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (is_string($endDate = self::getDateValue($endDate))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
// Validate parameters
if ($startDate >= $endDate) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Execute function
@@ -678,7 +678,7 @@ class DateTime
$endMonths = $PHPEndDateObject->format('n');
$endYears = $PHPEndDateObject->format('Y');
- $retVal = PHPExcel_Calculation_Functions::NaN();
+ $retVal = Functions::NaN();
switch ($unit) {
case 'D':
$retVal = intval($difference);
@@ -735,7 +735,7 @@ class DateTime
}
break;
default:
- $retVal = PHPExcel_Calculation_Functions::NaN();
+ $retVal = Functions::NaN();
}
return $retVal;
}
@@ -772,18 +772,18 @@ class DateTime
*/
public static function DAYS360($startDate = 0, $endDate = 0, $method = false)
{
- $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
- $endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
+ $startDate = Functions::flattenSingleValue($startDate);
+ $endDate = Functions::flattenSingleValue($endDate);
if (is_string($startDate = self::getDateValue($startDate))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (is_string($endDate = self::getDateValue($endDate))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (!is_bool($method)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
// Execute function
@@ -828,15 +828,15 @@ class DateTime
*/
public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0)
{
- $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
- $endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
- $method = PHPExcel_Calculation_Functions::flattenSingleValue($method);
+ $startDate = Functions::flattenSingleValue($startDate);
+ $endDate = Functions::flattenSingleValue($endDate);
+ $method = Functions::flattenSingleValue($method);
if (is_string($startDate = self::getDateValue($startDate))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (is_string($endDate = self::getDateValue($endDate))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (((is_numeric($method)) && (!is_string($method))) || ($method == '')) {
@@ -895,7 +895,7 @@ class DateTime
return self::DAYS360($startDate, $endDate, true) / 360;
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -925,20 +925,20 @@ class DateTime
public static function NETWORKDAYS($startDate, $endDate)
{
// Retrieve the mandatory start and end date that are referenced in the function definition
- $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
- $endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
+ $startDate = Functions::flattenSingleValue($startDate);
+ $endDate = Functions::flattenSingleValue($endDate);
// Flush the mandatory start and end date that are referenced in the function definition, and get the optional days
- $dateArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $dateArgs = Functions::flattenArray(func_get_args());
array_shift($dateArgs);
array_shift($dateArgs);
// Validate the start and end dates
if (is_string($startDate = $sDate = self::getDateValue($startDate))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$startDate = (float) floor($startDate);
if (is_string($endDate = $eDate = self::getDateValue($endDate))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$endDate = (float) floor($endDate);
@@ -967,7 +967,7 @@ class DateTime
$holidayCountedArray = array();
foreach ($dateArgs as $holidayDate) {
if (is_string($holidayDate = self::getDateValue($holidayDate))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
if ((self::DAYOFWEEK($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
@@ -1012,15 +1012,15 @@ class DateTime
public static function WORKDAY($startDate, $endDays)
{
// Retrieve the mandatory start date and days that are referenced in the function definition
- $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
- $endDays = PHPExcel_Calculation_Functions::flattenSingleValue($endDays);
+ $startDate = Functions::flattenSingleValue($startDate);
+ $endDays = Functions::flattenSingleValue($endDays);
// Flush the mandatory start date and days that are referenced in the function definition, and get the optional days
- $dateArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $dateArgs = Functions::flattenArray(func_get_args());
array_shift($dateArgs);
array_shift($dateArgs);
if ((is_string($startDate = self::getDateValue($startDate))) || (!is_numeric($endDays))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$startDate = (float) floor($startDate);
$endDays = (int) floor($endDays);
@@ -1054,7 +1054,7 @@ class DateTime
foreach ($dateArgs as $holidayDate) {
if (($holidayDate !== null) && (trim($holidayDate) > '')) {
if (is_string($holidayDate = self::getDateValue($holidayDate))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (self::DAYOFWEEK($holidayDate, 3) < 5) {
$holidayDates[] = $holidayDate;
@@ -1090,12 +1090,12 @@ class DateTime
}
}
- switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
- case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
+ switch (Functions::getReturnDateType()) {
+ case Functions::RETURNDATE_EXCEL:
return (float) $endDate;
- case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
+ case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) PHPExcel_Shared_Date::ExcelToPHP($endDate);
- case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
+ case Functions::RETURNDATE_PHP_OBJECT:
return PHPExcel_Shared_Date::ExcelToPHPObject($endDate);
}
}
@@ -1116,16 +1116,16 @@ class DateTime
*/
public static function DAYOFMONTH($dateValue = 1)
{
- $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
+ $dateValue = Functions::flattenSingleValue($dateValue);
if ($dateValue === null) {
$dateValue = 1;
} elseif (is_string($dateValue = self::getDateValue($dateValue))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif ($dateValue == 0.0) {
return 0;
} elseif ($dateValue < 0.0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Execute function
@@ -1154,22 +1154,22 @@ class DateTime
*/
public static function DAYOFWEEK($dateValue = 1, $style = 1)
{
- $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
- $style = PHPExcel_Calculation_Functions::flattenSingleValue($style);
+ $dateValue = Functions::flattenSingleValue($dateValue);
+ $style = Functions::flattenSingleValue($style);
if (!is_numeric($style)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif (($style < 1) || ($style > 3)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$style = floor($style);
if ($dateValue === null) {
$dateValue = 1;
} elseif (is_string($dateValue = self::getDateValue($dateValue))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif ($dateValue < 0.0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Execute function
@@ -1194,7 +1194,7 @@ class DateTime
--$DoW;
break;
}
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_EXCEL) {
// Test for Excel's 1900 leap year, and introduce the error as required
if (($PHPDateObject->format('Y') == 1900) && ($PHPDateObject->format('n') <= 2)) {
--$DoW;
@@ -1230,22 +1230,22 @@ class DateTime
*/
public static function WEEKOFYEAR($dateValue = 1, $method = 1)
{
- $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
- $method = PHPExcel_Calculation_Functions::flattenSingleValue($method);
+ $dateValue = Functions::flattenSingleValue($dateValue);
+ $method = Functions::flattenSingleValue($method);
if (!is_numeric($method)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif (($method < 1) || ($method > 2)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$method = floor($method);
if ($dateValue === null) {
$dateValue = 1;
} elseif (is_string($dateValue = self::getDateValue($dateValue))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif ($dateValue < 0.0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Execute function
@@ -1277,14 +1277,14 @@ class DateTime
*/
public static function MONTHOFYEAR($dateValue = 1)
{
- $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
+ $dateValue = Functions::flattenSingleValue($dateValue);
if ($dateValue === null) {
$dateValue = 1;
} elseif (is_string($dateValue = self::getDateValue($dateValue))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif ($dateValue < 0.0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Execute function
@@ -1309,14 +1309,14 @@ class DateTime
*/
public static function YEAR($dateValue = 1)
{
- $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
+ $dateValue = Functions::flattenSingleValue($dateValue);
if ($dateValue === null) {
$dateValue = 1;
} elseif (is_string($dateValue = self::getDateValue($dateValue))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif ($dateValue < 0.0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Execute function
@@ -1341,25 +1341,25 @@ class DateTime
*/
public static function HOUROFDAY($timeValue = 0)
{
- $timeValue = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
+ $timeValue = Functions::flattenSingleValue($timeValue);
if (!is_numeric($timeValue)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
$testVal = strtok($timeValue, '/-: ');
if (strlen($testVal) < strlen($timeValue)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
$timeValue = self::getTimeValue($timeValue);
if (is_string($timeValue)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
// Execute function
if ($timeValue >= 1) {
$timeValue = fmod($timeValue, 1);
} elseif ($timeValue < 0.0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
@@ -1382,25 +1382,25 @@ class DateTime
*/
public static function MINUTEOFHOUR($timeValue = 0)
{
- $timeValue = $timeTester = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
+ $timeValue = $timeTester = Functions::flattenSingleValue($timeValue);
if (!is_numeric($timeValue)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
$testVal = strtok($timeValue, '/-: ');
if (strlen($testVal) < strlen($timeValue)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
$timeValue = self::getTimeValue($timeValue);
if (is_string($timeValue)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
// Execute function
if ($timeValue >= 1) {
$timeValue = fmod($timeValue, 1);
} elseif ($timeValue < 0.0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
@@ -1423,25 +1423,25 @@ class DateTime
*/
public static function SECONDOFMINUTE($timeValue = 0)
{
- $timeValue = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
+ $timeValue = Functions::flattenSingleValue($timeValue);
if (!is_numeric($timeValue)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
$testVal = strtok($timeValue, '/-: ');
if (strlen($testVal) < strlen($timeValue)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
$timeValue = self::getTimeValue($timeValue);
if (is_string($timeValue)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
// Execute function
if ($timeValue >= 1) {
$timeValue = fmod($timeValue, 1);
} elseif ($timeValue < 0.0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
@@ -1470,27 +1470,27 @@ class DateTime
*/
public static function EDATE($dateValue = 1, $adjustmentMonths = 0)
{
- $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
- $adjustmentMonths = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
+ $dateValue = Functions::flattenSingleValue($dateValue);
+ $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths);
if (!is_numeric($adjustmentMonths)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$adjustmentMonths = floor($adjustmentMonths);
if (is_string($dateValue = self::getDateValue($dateValue))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
// Execute function
$PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths);
- switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
- case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
+ switch (Functions::getReturnDateType()) {
+ case Functions::RETURNDATE_EXCEL:
return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject);
- case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
+ case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject));
- case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
+ case Functions::RETURNDATE_PHP_OBJECT:
return $PHPDateObject;
}
}
@@ -1516,16 +1516,16 @@ class DateTime
*/
public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0)
{
- $dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
- $adjustmentMonths = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
+ $dateValue = Functions::flattenSingleValue($dateValue);
+ $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths);
if (!is_numeric($adjustmentMonths)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$adjustmentMonths = floor($adjustmentMonths);
if (is_string($dateValue = self::getDateValue($dateValue))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
// Execute function
@@ -1534,12 +1534,12 @@ class DateTime
$adjustDaysString = '-' . $adjustDays . ' days';
$PHPDateObject->modify($adjustDaysString);
- switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
- case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
+ switch (Functions::getReturnDateType()) {
+ case Functions::RETURNDATE_EXCEL:
return (float) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject);
- case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
+ case Functions::RETURNDATE_PHP_NUMERIC:
return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject));
- case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
+ case Functions::RETURNDATE_PHP_OBJECT:
return $PHPDateObject;
}
}
diff --git a/classes/src/Calculation/Engineering.php b/classes/src/Calculation/Engineering.php
index ffc8f4b8..ecbeae09 100644
--- a/classes/src/Calculation/Engineering.php
+++ b/classes/src/Calculation/Engineering.php
@@ -830,7 +830,7 @@ class Engineering
if (strlen($xVal) <= $places) {
return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10);
} else {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
}
@@ -859,17 +859,17 @@ class Engineering
*/
public static function BESSELI($x, $ord)
{
- $x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
+ $x = (is_null($x)) ? 0.0 : Functions::flattenSingleValue($x);
+ $ord = (is_null($ord)) ? 0.0 : Functions::flattenSingleValue($ord);
if ((is_numeric($x)) && (is_numeric($ord))) {
$ord = floor($ord);
if ($ord < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if (abs($x) <= 30) {
- $fResult = $fTerm = pow($x / 2, $ord) / PHPExcel_Calculation_MathTrig::FACT($ord);
+ $fResult = $fTerm = pow($x / 2, $ord) / MathTrig::FACT($ord);
$ordK = 1;
$fSqrX = ($x * $x) / 4;
do {
@@ -886,9 +886,9 @@ class Engineering
$fResult = -$fResult;
}
}
- return (is_nan($fResult)) ? PHPExcel_Calculation_Functions::NaN() : $fResult;
+ return (is_nan($fResult)) ? Functions::NaN() : $fResult;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -912,18 +912,18 @@ class Engineering
*/
public static function BESSELJ($x, $ord)
{
- $x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
+ $x = (is_null($x)) ? 0.0 : Functions::flattenSingleValue($x);
+ $ord = (is_null($ord)) ? 0.0 : Functions::flattenSingleValue($ord);
if ((is_numeric($x)) && (is_numeric($ord))) {
$ord = floor($ord);
if ($ord < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$fResult = 0;
if (abs($x) <= 30) {
- $fResult = $fTerm = pow($x / 2, $ord) / PHPExcel_Calculation_MathTrig::FACT($ord);
+ $fResult = $fTerm = pow($x / 2, $ord) / MathTrig::FACT($ord);
$ordK = 1;
$fSqrX = ($x * $x) / -4;
do {
@@ -941,9 +941,9 @@ class Engineering
$fResult = -$fResult;
}
}
- return (is_nan($fResult)) ? PHPExcel_Calculation_Functions::NaN() : $fResult;
+ return (is_nan($fResult)) ? Functions::NaN() : $fResult;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1004,12 +1004,12 @@ class Engineering
*/
public static function BESSELK($x, $ord)
{
- $x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
+ $x = (is_null($x)) ? 0.0 : Functions::flattenSingleValue($x);
+ $ord = (is_null($ord)) ? 0.0 : Functions::flattenSingleValue($ord);
if ((is_numeric($x)) && (is_numeric($ord))) {
if (($ord < 0) || ($x == 0.0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
switch (floor($ord)) {
@@ -1027,9 +1027,9 @@ class Engineering
$fBk = $fBkp;
}
}
- return (is_nan($fBk)) ? PHPExcel_Calculation_Functions::NaN() : $fBk;
+ return (is_nan($fBk)) ? Functions::NaN() : $fBk;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1088,12 +1088,12 @@ class Engineering
*/
public static function BESSELY($x, $ord)
{
- $x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
+ $x = (is_null($x)) ? 0.0 : Functions::flattenSingleValue($x);
+ $ord = (is_null($ord)) ? 0.0 : Functions::flattenSingleValue($ord);
if ((is_numeric($x)) && (is_numeric($ord))) {
if (($ord < 0) || ($x == 0.0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
switch (floor($ord)) {
@@ -1111,9 +1111,9 @@ class Engineering
$fBy = $fByp;
}
}
- return (is_nan($fBy)) ? PHPExcel_Calculation_Functions::NaN() : $fBy;
+ return (is_nan($fBy)) ? Functions::NaN() : $fBy;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1137,24 +1137,24 @@ class Engineering
*/
public static function BINTODEC($x)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
+ $x = Functions::flattenSingleValue($x);
if (is_bool($x)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$x = (int) $x;
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
$x = floor($x);
}
$x = (string) $x;
if (strlen($x) > preg_match_all('/[01]/', $x, $out)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if (strlen($x) > 10) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif (strlen($x) == 10) {
// Two's Complement
$x = substr($x, -9);
@@ -1190,25 +1190,25 @@ class Engineering
*/
public static function BINTOHEX($x, $places = null)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
+ $x = Functions::flattenSingleValue($x);
+ $places = Functions::flattenSingleValue($places);
if (is_bool($x)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$x = (int) $x;
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
$x = floor($x);
}
$x = (string) $x;
if (strlen($x) > preg_match_all('/[01]/', $x, $out)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if (strlen($x) > 10) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif (strlen($x) == 10) {
// Two's Complement
return str_repeat('F', 8).substr(strtoupper(dechex(bindec(substr($x, -9)))), -2);
@@ -1245,25 +1245,25 @@ class Engineering
*/
public static function BINTOOCT($x, $places = null)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
+ $x = Functions::flattenSingleValue($x);
+ $places = Functions::flattenSingleValue($places);
if (is_bool($x)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$x = (int) $x;
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
$x = floor($x);
}
$x = (string) $x;
if (strlen($x) > preg_match_all('/[01]/', $x, $out)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if (strlen($x) > 10) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif (strlen($x) == 10) {
// Two's Complement
return str_repeat('7', 7).substr(strtoupper(decoct(bindec(substr($x, -9)))), -3);
@@ -1304,19 +1304,19 @@ class Engineering
*/
public static function DECTOBIN($x, $places = null)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
+ $x = Functions::flattenSingleValue($x);
+ $places = Functions::flattenSingleValue($places);
if (is_bool($x)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$x = (int) $x;
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
$x = (string) $x;
if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$x = (string) floor($x);
$r = decbin($x);
@@ -1324,7 +1324,7 @@ class Engineering
// Two's Complement
$r = substr($r, -10);
} elseif (strlen($r) > 11) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return self::nbrConversionFormat($r, $places);
@@ -1361,19 +1361,19 @@ class Engineering
*/
public static function DECTOHEX($x, $places = null)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
+ $x = Functions::flattenSingleValue($x);
+ $places = Functions::flattenSingleValue($places);
if (is_bool($x)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$x = (int) $x;
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
$x = (string) $x;
if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$x = (string) floor($x);
$r = strtoupper(dechex($x));
@@ -1416,19 +1416,19 @@ class Engineering
*/
public static function DECTOOCT($x, $places = null)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
+ $x = Functions::flattenSingleValue($x);
+ $places = Functions::flattenSingleValue($places);
if (is_bool($x)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$x = (int) $x;
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
$x = (string) $x;
if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$x = (string) floor($x);
$r = decoct($x);
@@ -1474,15 +1474,15 @@ class Engineering
*/
public static function HEXTOBIN($x, $places = null)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
+ $x = Functions::flattenSingleValue($x);
+ $places = Functions::flattenSingleValue($places);
if (is_bool($x)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$x = (string) $x;
if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$binVal = decbin(hexdec($x));
@@ -1511,14 +1511,14 @@ class Engineering
*/
public static function HEXTODEC($x)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
+ $x = Functions::flattenSingleValue($x);
if (is_bool($x)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$x = (string) $x;
if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return hexdec($x);
}
@@ -1558,15 +1558,15 @@ class Engineering
*/
public static function HEXTOOCT($x, $places = null)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
+ $x = Functions::flattenSingleValue($x);
+ $places = Functions::flattenSingleValue($places);
if (is_bool($x)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$x = (string) $x;
if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$octVal = decoct(hexdec($x));
@@ -1610,15 +1610,15 @@ class Engineering
*/
public static function OCTTOBIN($x, $places = null)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
+ $x = Functions::flattenSingleValue($x);
+ $places = Functions::flattenSingleValue($places);
if (is_bool($x)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$x = (string) $x;
if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$r = decbin(octdec($x));
@@ -1647,14 +1647,14 @@ class Engineering
*/
public static function OCTTODEC($x)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
+ $x = Functions::flattenSingleValue($x);
if (is_bool($x)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$x = (string) $x;
if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return octdec($x);
}
@@ -1691,15 +1691,15 @@ class Engineering
*/
public static function OCTTOHEX($x, $places = null)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
+ $x = Functions::flattenSingleValue($x);
+ $places = Functions::flattenSingleValue($places);
if (is_bool($x)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$x = (string) $x;
if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$hexVal = strtoupper(dechex(octdec($x)));
@@ -1725,9 +1725,9 @@ class Engineering
*/
public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i')
{
- $realNumber = (is_null($realNumber)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
- $imaginary = (is_null($imaginary)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($imaginary);
- $suffix = (is_null($suffix)) ? 'i' : PHPExcel_Calculation_Functions::flattenSingleValue($suffix);
+ $realNumber = (is_null($realNumber)) ? 0.0 : Functions::flattenSingleValue($realNumber);
+ $imaginary = (is_null($imaginary)) ? 0.0 : Functions::flattenSingleValue($imaginary);
+ $suffix = (is_null($suffix)) ? 'i' : Functions::flattenSingleValue($suffix);
if (((is_numeric($realNumber)) && (is_numeric($imaginary))) &&
(($suffix == 'i') || ($suffix == 'j') || ($suffix == ''))) {
@@ -1759,7 +1759,7 @@ class Engineering
return (string) $realNumber.$imaginary.$suffix;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1779,7 +1779,7 @@ class Engineering
*/
public static function IMAGINARY($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
return $parsedComplex['imaginary'];
@@ -1801,7 +1801,7 @@ class Engineering
*/
public static function IMREAL($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
return $parsedComplex['real'];
@@ -1821,7 +1821,7 @@ class Engineering
*/
public static function IMABS($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
@@ -1846,7 +1846,7 @@ class Engineering
*/
public static function IMARGUMENT($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
@@ -1881,7 +1881,7 @@ class Engineering
*/
public static function IMCONJUGATE($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
@@ -1912,7 +1912,7 @@ class Engineering
*/
public static function IMCOS($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
@@ -1943,7 +1943,7 @@ class Engineering
*/
public static function IMSIN($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
@@ -1972,7 +1972,7 @@ class Engineering
*/
public static function IMSQRT($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
@@ -2002,12 +2002,12 @@ class Engineering
*/
public static function IMLN($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$logR = log(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])));
@@ -2034,12 +2034,12 @@ class Engineering
*/
public static function IMLOG10($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
return log10($parsedComplex['real']);
}
@@ -2061,12 +2061,12 @@ class Engineering
*/
public static function IMLOG2($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
return log($parsedComplex['real'], 2);
}
@@ -2088,7 +2088,7 @@ class Engineering
*/
public static function IMEXP($complexNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::parseComplex($complexNumber);
@@ -2122,11 +2122,11 @@ class Engineering
*/
public static function IMPOWER($complexNumber, $realNumber)
{
- $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
- $realNumber = PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
+ $complexNumber = Functions::flattenSingleValue($complexNumber);
+ $realNumber = Functions::flattenSingleValue($realNumber);
if (!is_numeric($realNumber)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$parsedComplex = self::parseComplex($complexNumber);
@@ -2158,15 +2158,15 @@ class Engineering
*/
public static function IMDIV($complexDividend, $complexDivisor)
{
- $complexDividend = PHPExcel_Calculation_Functions::flattenSingleValue($complexDividend);
- $complexDivisor = PHPExcel_Calculation_Functions::flattenSingleValue($complexDivisor);
+ $complexDividend = Functions::flattenSingleValue($complexDividend);
+ $complexDivisor = Functions::flattenSingleValue($complexDivisor);
$parsedComplexDividend = self::parseComplex($complexDividend);
$parsedComplexDivisor = self::parseComplex($complexDivisor);
if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] != '') &&
($parsedComplexDividend['suffix'] != $parsedComplexDivisor['suffix'])) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] == '')) {
$parsedComplexDivisor['suffix'] = $parsedComplexDividend['suffix'];
@@ -2203,15 +2203,15 @@ class Engineering
*/
public static function IMSUB($complexNumber1, $complexNumber2)
{
- $complexNumber1 = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber1);
- $complexNumber2 = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber2);
+ $complexNumber1 = Functions::flattenSingleValue($complexNumber1);
+ $complexNumber2 = Functions::flattenSingleValue($complexNumber2);
$parsedComplex1 = self::parseComplex($complexNumber1);
$parsedComplex2 = self::parseComplex($complexNumber2);
if ((($parsedComplex1['suffix'] != '') && ($parsedComplex2['suffix'] != '')) &&
($parsedComplex1['suffix'] != $parsedComplex2['suffix'])) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif (($parsedComplex1['suffix'] == '') && ($parsedComplex2['suffix'] != '')) {
$parsedComplex1['suffix'] = $parsedComplex2['suffix'];
}
@@ -2241,14 +2241,14 @@ class Engineering
$activeSuffix = '';
// Loop through the arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
foreach ($aArgs as $arg) {
$parsedComplex = self::parseComplex($arg);
if ($activeSuffix == '') {
$activeSuffix = $parsedComplex['suffix'];
} elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$returnValue['real'] += $parsedComplex['real'];
@@ -2280,7 +2280,7 @@ class Engineering
$activeSuffix = '';
// Loop through the arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
foreach ($aArgs as $arg) {
$parsedComplex = self::parseComplex($arg);
@@ -2288,7 +2288,7 @@ class Engineering
if (($parsedComplex['suffix'] != '') && ($activeSuffix == '')) {
$activeSuffix = $parsedComplex['suffix'];
} elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$returnValue['real'] = ($workValue['real'] * $parsedComplex['real']) - ($workValue['imaginary'] * $parsedComplex['imaginary']);
$returnValue['imaginary'] = ($workValue['real'] * $parsedComplex['imaginary']) + ($workValue['imaginary'] * $parsedComplex['real']);
@@ -2318,8 +2318,8 @@ class Engineering
*/
public static function DELTA($a, $b = 0)
{
- $a = PHPExcel_Calculation_Functions::flattenSingleValue($a);
- $b = PHPExcel_Calculation_Functions::flattenSingleValue($b);
+ $a = Functions::flattenSingleValue($a);
+ $b = Functions::flattenSingleValue($b);
return (int) ($a == $b);
}
@@ -2342,8 +2342,8 @@ class Engineering
*/
public static function GESTEP($number, $step = 0)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
- $step = PHPExcel_Calculation_Functions::flattenSingleValue($step);
+ $number = Functions::flattenSingleValue($number);
+ $step = Functions::flattenSingleValue($step);
return (int) ($number >= $step);
}
@@ -2397,8 +2397,8 @@ class Engineering
*/
public static function ERF($lower, $upper = null)
{
- $lower = PHPExcel_Calculation_Functions::flattenSingleValue($lower);
- $upper = PHPExcel_Calculation_Functions::flattenSingleValue($upper);
+ $lower = Functions::flattenSingleValue($lower);
+ $upper = Functions::flattenSingleValue($upper);
if (is_numeric($lower)) {
if (is_null($upper)) {
@@ -2408,7 +2408,7 @@ class Engineering
return self::erfVal($upper) - self::erfVal($lower);
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2463,12 +2463,12 @@ class Engineering
*/
public static function ERFC($x)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
+ $x = Functions::flattenSingleValue($x);
if (is_numeric($x)) {
return self::erfcVal($x);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2558,12 +2558,12 @@ class Engineering
*/
public static function CONVERTUOM($value, $fromUOM, $toUOM)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $fromUOM = PHPExcel_Calculation_Functions::flattenSingleValue($fromUOM);
- $toUOM = PHPExcel_Calculation_Functions::flattenSingleValue($toUOM);
+ $value = Functions::flattenSingleValue($value);
+ $fromUOM = Functions::flattenSingleValue($fromUOM);
+ $toUOM = Functions::flattenSingleValue($toUOM);
if (!is_numeric($value)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$fromMultiplier = 1.0;
if (isset(self::$conversionUnits[$fromUOM])) {
@@ -2574,12 +2574,12 @@ class Engineering
if (isset(self::$conversionMultipliers[$fromMultiplier])) {
$fromMultiplier = self::$conversionMultipliers[$fromMultiplier]['multiplier'];
} else {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
if ((isset(self::$conversionUnits[$fromUOM])) && (self::$conversionUnits[$fromUOM]['AllowPrefix'])) {
$unitGroup1 = self::$conversionUnits[$fromUOM]['Group'];
} else {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
}
$value *= $fromMultiplier;
@@ -2593,16 +2593,16 @@ class Engineering
if (isset(self::$conversionMultipliers[$toMultiplier])) {
$toMultiplier = self::$conversionMultipliers[$toMultiplier]['multiplier'];
} else {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
if ((isset(self::$conversionUnits[$toUOM])) && (self::$conversionUnits[$toUOM]['AllowPrefix'])) {
$unitGroup2 = self::$conversionUnits[$toUOM]['Group'];
} else {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
}
if ($unitGroup1 != $unitGroup2) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
if (($fromUOM == $toUOM) && ($fromMultiplier == $toMultiplier)) {
diff --git a/classes/src/Calculation/Financial.php b/classes/src/Calculation/Financial.php
index 2dfea0a2..56b75d00 100644
--- a/classes/src/Calculation/Financial.php
+++ b/classes/src/Calculation/Financial.php
@@ -90,7 +90,7 @@ class Financial
if (($frequency == 1) || ($frequency == 2) || ($frequency == 4)) {
return true;
}
- if ((PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) &&
+ if ((Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) &&
(($frequency == 6) || ($frequency == 12))) {
return true;
}
@@ -124,10 +124,10 @@ class Financial
$daysPerYear = 365;
break;
case 1:
- $daysPerYear = (PHPExcel_Calculation_DateTime::isLeapYear($year)) ? 366 : 365;
+ $daysPerYear = (DateTime::isLeapYear($year)) ? 366 : 365;
break;
default:
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return $daysPerYear;
}
@@ -183,22 +183,22 @@ class Financial
*/
public static function ACCRINT($issue, $firstinterest, $settlement, $rate, $par = 1000, $frequency = 1, $basis = 0)
{
- $issue = PHPExcel_Calculation_Functions::flattenSingleValue($issue);
- $firstinterest = PHPExcel_Calculation_Functions::flattenSingleValue($firstinterest);
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $par = (is_null($par)) ? 1000 : PHPExcel_Calculation_Functions::flattenSingleValue($par);
- $frequency = (is_null($frequency)) ? 1 : PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
- $basis = (is_null($basis)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $issue = Functions::flattenSingleValue($issue);
+ $firstinterest = Functions::flattenSingleValue($firstinterest);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $rate = Functions::flattenSingleValue($rate);
+ $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par);
+ $frequency = (is_null($frequency)) ? 1 : Functions::flattenSingleValue($frequency);
+ $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis);
// Validate
if ((is_numeric($rate)) && (is_numeric($par))) {
$rate = (float) $rate;
$par = (float) $par;
if (($rate <= 0) || ($par <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
+ $daysBetweenIssueAndSettlement = DateTime::YEARFRAC($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
@@ -206,7 +206,7 @@ class Financial
return $par * $rate * $daysBetweenIssueAndSettlement;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -235,27 +235,27 @@ class Financial
*/
public static function ACCRINTM($issue, $settlement, $rate, $par = 1000, $basis = 0)
{
- $issue = PHPExcel_Calculation_Functions::flattenSingleValue($issue);
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $par = (is_null($par)) ? 1000 : PHPExcel_Calculation_Functions::flattenSingleValue($par);
- $basis = (is_null($basis)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $issue = Functions::flattenSingleValue($issue);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $rate = Functions::flattenSingleValue($rate);
+ $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par);
+ $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis);
// Validate
if ((is_numeric($rate)) && (is_numeric($par))) {
$rate = (float) $rate;
$par = (float) $par;
if (($rate <= 0) || ($par <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
+ $daysBetweenIssueAndSettlement = DateTime::YEARFRAC($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
}
return $par * $rate * $daysBetweenIssueAndSettlement;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -292,13 +292,13 @@ class Financial
*/
public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0)
{
- $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
- $purchased = PHPExcel_Calculation_Functions::flattenSingleValue($purchased);
- $firstPeriod = PHPExcel_Calculation_Functions::flattenSingleValue($firstPeriod);
- $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
- $period = floor(PHPExcel_Calculation_Functions::flattenSingleValue($period));
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $cost = Functions::flattenSingleValue($cost);
+ $purchased = Functions::flattenSingleValue($purchased);
+ $firstPeriod = Functions::flattenSingleValue($firstPeriod);
+ $salvage = Functions::flattenSingleValue($salvage);
+ $period = floor(Functions::flattenSingleValue($period));
+ $rate = Functions::flattenSingleValue($rate);
+ $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis);
// The depreciation coefficients are:
// Life of assets (1/rate) Depreciation coefficient
@@ -318,7 +318,7 @@ class Financial
}
$rate *= $amortiseCoeff;
- $fNRate = round(PHPExcel_Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis) * $rate * $cost, 0);
+ $fNRate = round(DateTime::YEARFRAC($purchased, $firstPeriod, $basis) * $rate * $cost, 0);
$cost -= $fNRate;
$fRest = $cost - $salvage;
@@ -369,21 +369,21 @@ class Financial
*/
public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0)
{
- $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
- $purchased = PHPExcel_Calculation_Functions::flattenSingleValue($purchased);
- $firstPeriod = PHPExcel_Calculation_Functions::flattenSingleValue($firstPeriod);
- $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
- $period = PHPExcel_Calculation_Functions::flattenSingleValue($period);
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $cost = Functions::flattenSingleValue($cost);
+ $purchased = Functions::flattenSingleValue($purchased);
+ $firstPeriod = Functions::flattenSingleValue($firstPeriod);
+ $salvage = Functions::flattenSingleValue($salvage);
+ $period = Functions::flattenSingleValue($period);
+ $rate = Functions::flattenSingleValue($rate);
+ $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis);
$fOneRate = $cost * $rate;
$fCostDelta = $cost - $salvage;
// Note, quirky variation for leap years on the YEARFRAC for this function
- $purchasedYear = PHPExcel_Calculation_DateTime::YEAR($purchased);
- $yearFrac = PHPExcel_Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis);
+ $purchasedYear = DateTime::YEAR($purchased);
+ $yearFrac = DateTime::YEARFRAC($purchased, $firstPeriod, $basis);
- if (($basis == 1) && ($yearFrac < 1) && (PHPExcel_Calculation_DateTime::isLeapYear($purchasedYear))) {
+ if (($basis == 1) && ($yearFrac < 1) && (DateTime::isLeapYear($purchasedYear))) {
$yearFrac *= 365 / 366;
}
@@ -436,28 +436,28 @@ class Financial
*/
public static function COUPDAYBS($settlement, $maturity, $frequency, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
- $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $frequency = (int) Functions::flattenSingleValue($frequency);
+ $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis);
- if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($settlement = DateTime::getDateValue($settlement))) {
+ return Functions::VALUE();
}
- if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($maturity = DateTime::getDateValue($maturity))) {
+ return Functions::VALUE();
}
if (($settlement > $maturity) ||
(!self::isValidFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
+ $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis);
$prev = self::couponFirstPeriodDate($settlement, $maturity, $frequency, false);
- return PHPExcel_Calculation_DateTime::YEARFRAC($prev, $settlement, $basis) * $daysPerYear;
+ return DateTime::YEARFRAC($prev, $settlement, $basis) * $daysPerYear;
}
@@ -495,22 +495,22 @@ class Financial
*/
public static function COUPDAYS($settlement, $maturity, $frequency, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
- $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $frequency = (int) Functions::flattenSingleValue($frequency);
+ $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis);
- if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($settlement = DateTime::getDateValue($settlement))) {
+ return Functions::VALUE();
}
- if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($maturity = DateTime::getDateValue($maturity))) {
+ return Functions::VALUE();
}
if (($settlement > $maturity) ||
(!self::isValidFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
switch ($basis) {
@@ -520,7 +520,7 @@ class Financial
case 1:
// Actual/actual
if ($frequency == 1) {
- $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($maturity), $basis);
+ $daysPerYear = self::daysPerYear(DateTime::YEAR($maturity), $basis);
return ($daysPerYear / $frequency);
}
$prev = self::couponFirstPeriodDate($settlement, $maturity, $frequency, false);
@@ -530,7 +530,7 @@ class Financial
// US (NASD) 30/360, Actual/360 or European 30/360
return 360 / $frequency;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -568,28 +568,28 @@ class Financial
*/
public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
- $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $frequency = (int) Functions::flattenSingleValue($frequency);
+ $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis);
- if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($settlement = DateTime::getDateValue($settlement))) {
+ return Functions::VALUE();
}
- if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($maturity = DateTime::getDateValue($maturity))) {
+ return Functions::VALUE();
}
if (($settlement > $maturity) ||
(!self::isValidFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
+ $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis);
$next = self::couponFirstPeriodDate($settlement, $maturity, $frequency, true);
- return PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $next, $basis) * $daysPerYear;
+ return DateTime::YEARFRAC($settlement, $next, $basis) * $daysPerYear;
}
@@ -628,22 +628,22 @@ class Financial
*/
public static function COUPNCD($settlement, $maturity, $frequency, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
- $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $frequency = (int) Functions::flattenSingleValue($frequency);
+ $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis);
- if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($settlement = DateTime::getDateValue($settlement))) {
+ return Functions::VALUE();
}
- if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($maturity = DateTime::getDateValue($maturity))) {
+ return Functions::VALUE();
}
if (($settlement > $maturity) ||
(!self::isValidFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return self::couponFirstPeriodDate($settlement, $maturity, $frequency, true);
@@ -685,26 +685,26 @@ class Financial
*/
public static function COUPNUM($settlement, $maturity, $frequency, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
- $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $frequency = (int) Functions::flattenSingleValue($frequency);
+ $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis);
- if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($settlement = DateTime::getDateValue($settlement))) {
+ return Functions::VALUE();
}
- if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($maturity = DateTime::getDateValue($maturity))) {
+ return Functions::VALUE();
}
if (($settlement > $maturity) ||
(!self::isValidFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$settlement = self::couponFirstPeriodDate($settlement, $maturity, $frequency, true);
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis) * 365;
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis) * 365;
switch ($frequency) {
case 1: // annual payments
@@ -718,7 +718,7 @@ class Financial
case 12: // monthly
return ceil($daysBetweenSettlementAndMaturity / 30);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -757,22 +757,22 @@ class Financial
*/
public static function COUPPCD($settlement, $maturity, $frequency, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
- $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $frequency = (int) Functions::flattenSingleValue($frequency);
+ $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis);
- if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($settlement = DateTime::getDateValue($settlement))) {
+ return Functions::VALUE();
}
- if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($maturity = DateTime::getDateValue($maturity))) {
+ return Functions::VALUE();
}
if (($settlement > $maturity) ||
(!self::isValidFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return self::couponFirstPeriodDate($settlement, $maturity, $frequency, false);
@@ -802,19 +802,19 @@ class Financial
*/
public static function CUMIPMT($rate, $nper, $pv, $start, $end, $type = 0)
{
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
- $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
- $start = (int) PHPExcel_Calculation_Functions::flattenSingleValue($start);
- $end = (int) PHPExcel_Calculation_Functions::flattenSingleValue($end);
- $type = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
+ $rate = Functions::flattenSingleValue($rate);
+ $nper = (int) Functions::flattenSingleValue($nper);
+ $pv = Functions::flattenSingleValue($pv);
+ $start = (int) Functions::flattenSingleValue($start);
+ $end = (int) Functions::flattenSingleValue($end);
+ $type = (int) Functions::flattenSingleValue($type);
// Validate parameters
if ($type != 0 && $type != 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ($start < 1 || $start > $end) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
// Calculate
@@ -850,19 +850,19 @@ class Financial
*/
public static function CUMPRINC($rate, $nper, $pv, $start, $end, $type = 0)
{
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
- $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
- $start = (int) PHPExcel_Calculation_Functions::flattenSingleValue($start);
- $end = (int) PHPExcel_Calculation_Functions::flattenSingleValue($end);
- $type = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
+ $rate = Functions::flattenSingleValue($rate);
+ $nper = (int) Functions::flattenSingleValue($nper);
+ $pv = Functions::flattenSingleValue($pv);
+ $start = (int) Functions::flattenSingleValue($start);
+ $end = (int) Functions::flattenSingleValue($end);
+ $type = (int) Functions::flattenSingleValue($type);
// Validate parameters
if ($type != 0 && $type != 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ($start < 1 || $start > $end) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
// Calculate
@@ -903,11 +903,11 @@ class Financial
*/
public static function DB($cost, $salvage, $life, $period, $month = 12)
{
- $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
- $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
- $life = PHPExcel_Calculation_Functions::flattenSingleValue($life);
- $period = PHPExcel_Calculation_Functions::flattenSingleValue($period);
- $month = PHPExcel_Calculation_Functions::flattenSingleValue($month);
+ $cost = Functions::flattenSingleValue($cost);
+ $salvage = Functions::flattenSingleValue($salvage);
+ $life = Functions::flattenSingleValue($life);
+ $period = Functions::flattenSingleValue($period);
+ $month = Functions::flattenSingleValue($month);
// Validate
if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) {
@@ -919,7 +919,7 @@ class Financial
if ($cost == 0) {
return 0.0;
} elseif (($cost < 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($month < 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Set Fixed Depreciation Rate
$fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
@@ -937,12 +937,12 @@ class Financial
}
$previousDepreciation += $depreciation;
}
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
$depreciation = round($depreciation, 2);
}
return $depreciation;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -971,11 +971,11 @@ class Financial
*/
public static function DDB($cost, $salvage, $life, $period, $factor = 2.0)
{
- $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
- $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
- $life = PHPExcel_Calculation_Functions::flattenSingleValue($life);
- $period = PHPExcel_Calculation_Functions::flattenSingleValue($period);
- $factor = PHPExcel_Calculation_Functions::flattenSingleValue($factor);
+ $cost = Functions::flattenSingleValue($cost);
+ $salvage = Functions::flattenSingleValue($salvage);
+ $life = Functions::flattenSingleValue($life);
+ $period = Functions::flattenSingleValue($period);
+ $factor = Functions::flattenSingleValue($factor);
// Validate
if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($factor))) {
@@ -985,7 +985,7 @@ class Financial
$period = (int) $period;
$factor = (float) $factor;
if (($cost <= 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($factor <= 0.0) || ($period > $life)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Set Fixed Depreciation Rate
$fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
@@ -997,12 +997,12 @@ class Financial
$depreciation = min(($cost - $previousDepreciation) * ($factor / $life), ($cost - $salvage - $previousDepreciation));
$previousDepreciation += $depreciation;
}
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
$depreciation = round($depreciation, 2);
}
return $depreciation;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1033,11 +1033,11 @@ class Financial
*/
public static function DISC($settlement, $maturity, $price, $redemption, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $price = PHPExcel_Calculation_Functions::flattenSingleValue($price);
- $redemption = PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
- $basis = PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $price = Functions::flattenSingleValue($price);
+ $redemption = Functions::flattenSingleValue($redemption);
+ $basis = Functions::flattenSingleValue($basis);
// Validate
if ((is_numeric($price)) && (is_numeric($redemption)) && (is_numeric($basis))) {
@@ -1045,9 +1045,9 @@ class Financial
$redemption = (float) $redemption;
$basis = (int) $basis;
if (($price <= 0) || ($redemption <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@@ -1055,7 +1055,7 @@ class Financial
return ((1 - $price / $redemption) / $daysBetweenSettlementAndMaturity);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1077,15 +1077,15 @@ class Financial
*/
public static function DOLLARDE($fractional_dollar = null, $fraction = 0)
{
- $fractional_dollar = PHPExcel_Calculation_Functions::flattenSingleValue($fractional_dollar);
- $fraction = (int)PHPExcel_Calculation_Functions::flattenSingleValue($fraction);
+ $fractional_dollar = Functions::flattenSingleValue($fractional_dollar);
+ $fraction = (int)Functions::flattenSingleValue($fraction);
// Validate parameters
if (is_null($fractional_dollar) || $fraction < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ($fraction == 0) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
$dollars = floor($fractional_dollar);
@@ -1114,15 +1114,15 @@ class Financial
*/
public static function DOLLARFR($decimal_dollar = null, $fraction = 0)
{
- $decimal_dollar = PHPExcel_Calculation_Functions::flattenSingleValue($decimal_dollar);
- $fraction = (int)PHPExcel_Calculation_Functions::flattenSingleValue($fraction);
+ $decimal_dollar = Functions::flattenSingleValue($decimal_dollar);
+ $fraction = (int)Functions::flattenSingleValue($fraction);
// Validate parameters
if (is_null($decimal_dollar) || $fraction < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ($fraction == 0) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
$dollars = floor($decimal_dollar);
@@ -1150,12 +1150,12 @@ class Financial
*/
public static function EFFECT($nominal_rate = 0, $npery = 0)
{
- $nominal_rate = PHPExcel_Calculation_Functions::flattenSingleValue($nominal_rate);
- $npery = (int)PHPExcel_Calculation_Functions::flattenSingleValue($npery);
+ $nominal_rate = Functions::flattenSingleValue($nominal_rate);
+ $npery = (int)Functions::flattenSingleValue($npery);
// Validate parameters
if ($nominal_rate <= 0 || $npery < 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return pow((1 + $nominal_rate / $npery), $npery) - 1;
@@ -1186,15 +1186,15 @@ class Financial
*/
public static function FV($rate = 0, $nper = 0, $pmt = 0, $pv = 0, $type = 0)
{
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $nper = PHPExcel_Calculation_Functions::flattenSingleValue($nper);
- $pmt = PHPExcel_Calculation_Functions::flattenSingleValue($pmt);
- $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
- $type = PHPExcel_Calculation_Functions::flattenSingleValue($type);
+ $rate = Functions::flattenSingleValue($rate);
+ $nper = Functions::flattenSingleValue($nper);
+ $pmt = Functions::flattenSingleValue($pmt);
+ $pv = Functions::flattenSingleValue($pv);
+ $type = Functions::flattenSingleValue($type);
// Validate parameters
if ($type != 0 && $type != 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Calculate
@@ -1220,8 +1220,8 @@ class Financial
*/
public static function FVSCHEDULE($principal, $schedule)
{
- $principal = PHPExcel_Calculation_Functions::flattenSingleValue($principal);
- $schedule = PHPExcel_Calculation_Functions::flattenArray($schedule);
+ $principal = Functions::flattenSingleValue($principal);
+ $schedule = Functions::flattenArray($schedule);
foreach ($schedule as $rate) {
$principal *= 1 + $rate;
@@ -1255,11 +1255,11 @@ class Financial
*/
public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $investment = PHPExcel_Calculation_Functions::flattenSingleValue($investment);
- $redemption = PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
- $basis = PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $investment = Functions::flattenSingleValue($investment);
+ $redemption = Functions::flattenSingleValue($redemption);
+ $basis = Functions::flattenSingleValue($basis);
// Validate
if ((is_numeric($investment)) && (is_numeric($redemption)) && (is_numeric($basis))) {
@@ -1267,9 +1267,9 @@ class Financial
$redemption = (float) $redemption;
$basis = (int) $basis;
if (($investment <= 0) || ($redemption <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@@ -1277,7 +1277,7 @@ class Financial
return (($redemption / $investment) - 1) / ($daysBetweenSettlementAndMaturity);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1299,19 +1299,19 @@ class Financial
*/
public static function IPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0)
{
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $per = (int) PHPExcel_Calculation_Functions::flattenSingleValue($per);
- $nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
- $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
- $fv = PHPExcel_Calculation_Functions::flattenSingleValue($fv);
- $type = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
+ $rate = Functions::flattenSingleValue($rate);
+ $per = (int) Functions::flattenSingleValue($per);
+ $nper = (int) Functions::flattenSingleValue($nper);
+ $pv = Functions::flattenSingleValue($pv);
+ $fv = Functions::flattenSingleValue($fv);
+ $type = (int) Functions::flattenSingleValue($type);
// Validate parameters
if ($type != 0 && $type != 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ($per <= 0 || $per > $nper) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
// Calculate
@@ -1341,10 +1341,10 @@ class Financial
public static function IRR($values, $guess = 0.1)
{
if (!is_array($values)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
- $values = PHPExcel_Calculation_Functions::flattenArray($values);
- $guess = PHPExcel_Calculation_Functions::flattenSingleValue($guess);
+ $values = Functions::flattenArray($values);
+ $guess = Functions::flattenSingleValue($guess);
// create an initial range, with a root somewhere between 0 and guess
$x1 = 0.0;
@@ -1362,7 +1362,7 @@ class Financial
}
}
if (($f1 * $f2) > 0.0) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$f = self::NPV($x1, $values);
@@ -1385,7 +1385,7 @@ class Financial
return $x_mid;
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1411,7 +1411,7 @@ class Financial
$returnValue = 0;
// Get the parameters
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
$interestRate = array_shift($aArgs);
$period = array_shift($aArgs);
$numberPeriods = array_shift($aArgs);
@@ -1450,11 +1450,11 @@ class Financial
public static function MIRR($values, $finance_rate, $reinvestment_rate)
{
if (!is_array($values)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
- $values = PHPExcel_Calculation_Functions::flattenArray($values);
- $finance_rate = PHPExcel_Calculation_Functions::flattenSingleValue($finance_rate);
- $reinvestment_rate = PHPExcel_Calculation_Functions::flattenSingleValue($reinvestment_rate);
+ $values = Functions::flattenArray($values);
+ $finance_rate = Functions::flattenSingleValue($finance_rate);
+ $reinvestment_rate = Functions::flattenSingleValue($reinvestment_rate);
$n = count($values);
$rr = 1.0 + $reinvestment_rate;
@@ -1470,13 +1470,13 @@ class Financial
}
if (($npv_neg == 0) || ($npv_pos == 0) || ($reinvestment_rate <= -1)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$mirr = pow((-$npv_pos * pow($rr, $n))
/ ($npv_neg * ($rr)), (1.0 / ($n - 1))) - 1.0;
- return (is_finite($mirr) ? $mirr : PHPExcel_Calculation_Functions::VALUE());
+ return (is_finite($mirr) ? $mirr : Functions::VALUE());
}
@@ -1491,12 +1491,12 @@ class Financial
*/
public static function NOMINAL($effect_rate = 0, $npery = 0)
{
- $effect_rate = PHPExcel_Calculation_Functions::flattenSingleValue($effect_rate);
- $npery = (int)PHPExcel_Calculation_Functions::flattenSingleValue($npery);
+ $effect_rate = Functions::flattenSingleValue($effect_rate);
+ $npery = (int)Functions::flattenSingleValue($npery);
// Validate parameters
if ($effect_rate <= 0 || $npery < 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Calculate
@@ -1518,26 +1518,26 @@ class Financial
*/
public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0)
{
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $pmt = PHPExcel_Calculation_Functions::flattenSingleValue($pmt);
- $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
- $fv = PHPExcel_Calculation_Functions::flattenSingleValue($fv);
- $type = PHPExcel_Calculation_Functions::flattenSingleValue($type);
+ $rate = Functions::flattenSingleValue($rate);
+ $pmt = Functions::flattenSingleValue($pmt);
+ $pv = Functions::flattenSingleValue($pv);
+ $fv = Functions::flattenSingleValue($fv);
+ $type = Functions::flattenSingleValue($type);
// Validate parameters
if ($type != 0 && $type != 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Calculate
if (!is_null($rate) && $rate != 0) {
if ($pmt == 0 && $pv == 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return log(($pmt * (1 + $rate * $type) / $rate - $fv) / ($pv + $pmt * (1 + $rate * $type) / $rate)) / log(1 + $rate);
}
if ($pmt == 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return (-$pv -$fv) / $pmt;
}
@@ -1555,7 +1555,7 @@ class Financial
$returnValue = 0;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
// Calculate
$rate = array_shift($aArgs);
@@ -1584,15 +1584,15 @@ class Financial
*/
public static function PMT($rate = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0)
{
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $nper = PHPExcel_Calculation_Functions::flattenSingleValue($nper);
- $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
- $fv = PHPExcel_Calculation_Functions::flattenSingleValue($fv);
- $type = PHPExcel_Calculation_Functions::flattenSingleValue($type);
+ $rate = Functions::flattenSingleValue($rate);
+ $nper = Functions::flattenSingleValue($nper);
+ $pv = Functions::flattenSingleValue($pv);
+ $fv = Functions::flattenSingleValue($fv);
+ $type = Functions::flattenSingleValue($type);
// Validate parameters
if ($type != 0 && $type != 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Calculate
@@ -1618,19 +1618,19 @@ class Financial
*/
public static function PPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0)
{
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $per = (int) PHPExcel_Calculation_Functions::flattenSingleValue($per);
- $nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
- $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
- $fv = PHPExcel_Calculation_Functions::flattenSingleValue($fv);
- $type = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
+ $rate = Functions::flattenSingleValue($rate);
+ $per = (int) Functions::flattenSingleValue($per);
+ $nper = (int) Functions::flattenSingleValue($nper);
+ $pv = Functions::flattenSingleValue($pv);
+ $fv = Functions::flattenSingleValue($fv);
+ $type = (int) Functions::flattenSingleValue($type);
// Validate parameters
if ($type != 0 && $type != 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ($per <= 0 || $per > $nper) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
// Calculate
@@ -1641,25 +1641,25 @@ class Financial
public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $rate = (float) PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $yield = (float) PHPExcel_Calculation_Functions::flattenSingleValue($yield);
- $redemption = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
- $frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
- $basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $rate = (float) Functions::flattenSingleValue($rate);
+ $yield = (float) Functions::flattenSingleValue($yield);
+ $redemption = (float) Functions::flattenSingleValue($redemption);
+ $frequency = (int) Functions::flattenSingleValue($frequency);
+ $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis);
- if (is_string($settlement = PHPExcel_Calculation_DateTime::getDateValue($settlement))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($settlement = DateTime::getDateValue($settlement))) {
+ return Functions::VALUE();
}
- if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($maturity = DateTime::getDateValue($maturity))) {
+ return Functions::VALUE();
}
if (($settlement > $maturity) ||
(!self::isValidFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$dsc = self::COUPDAYSNC($settlement, $maturity, $frequency, $basis);
@@ -1702,18 +1702,18 @@ class Financial
*/
public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $discount = (float) PHPExcel_Calculation_Functions::flattenSingleValue($discount);
- $redemption = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
- $basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $discount = (float) Functions::flattenSingleValue($discount);
+ $redemption = (float) Functions::flattenSingleValue($redemption);
+ $basis = (int) Functions::flattenSingleValue($basis);
// Validate
if ((is_numeric($discount)) && (is_numeric($redemption)) && (is_numeric($basis))) {
if (($discount <= 0) || ($redemption <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@@ -1721,7 +1721,7 @@ class Financial
return $redemption * (1 - $discount * $daysBetweenSettlementAndMaturity);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1747,35 +1747,35 @@ class Financial
*/
public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $issue = PHPExcel_Calculation_Functions::flattenSingleValue($issue);
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $yield = PHPExcel_Calculation_Functions::flattenSingleValue($yield);
- $basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $issue = Functions::flattenSingleValue($issue);
+ $rate = Functions::flattenSingleValue($rate);
+ $yield = Functions::flattenSingleValue($yield);
+ $basis = (int) Functions::flattenSingleValue($basis);
// Validate
if (is_numeric($rate) && is_numeric($yield)) {
if (($rate <= 0) || ($yield <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
+ $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis);
if (!is_numeric($daysPerYear)) {
return $daysPerYear;
}
- $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
+ $daysBetweenIssueAndSettlement = DateTime::YEARFRAC($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
}
$daysBetweenIssueAndSettlement *= $daysPerYear;
- $daysBetweenIssueAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $maturity, $basis);
+ $daysBetweenIssueAndMaturity = DateTime::YEARFRAC($issue, $maturity, $basis);
if (!is_numeric($daysBetweenIssueAndMaturity)) {
// return date error
return $daysBetweenIssueAndMaturity;
}
$daysBetweenIssueAndMaturity *= $daysPerYear;
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@@ -1786,7 +1786,7 @@ class Financial
(1 + (($daysBetweenSettlementAndMaturity / $daysPerYear) * $yield)) -
(($daysBetweenIssueAndSettlement / $daysPerYear) * $rate * 100));
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1804,15 +1804,15 @@ class Financial
*/
public static function PV($rate = 0, $nper = 0, $pmt = 0, $fv = 0, $type = 0)
{
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $nper = PHPExcel_Calculation_Functions::flattenSingleValue($nper);
- $pmt = PHPExcel_Calculation_Functions::flattenSingleValue($pmt);
- $fv = PHPExcel_Calculation_Functions::flattenSingleValue($fv);
- $type = PHPExcel_Calculation_Functions::flattenSingleValue($type);
+ $rate = Functions::flattenSingleValue($rate);
+ $nper = Functions::flattenSingleValue($nper);
+ $pmt = Functions::flattenSingleValue($pmt);
+ $fv = Functions::flattenSingleValue($fv);
+ $type = Functions::flattenSingleValue($type);
// Validate parameters
if ($type != 0 && $type != 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// Calculate
@@ -1855,12 +1855,12 @@ class Financial
**/
public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1)
{
- $nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
- $pmt = PHPExcel_Calculation_Functions::flattenSingleValue($pmt);
- $pv = PHPExcel_Calculation_Functions::flattenSingleValue($pv);
- $fv = (is_null($fv)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($fv);
- $type = (is_null($type)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
- $guess = (is_null($guess)) ? 0.1 : PHPExcel_Calculation_Functions::flattenSingleValue($guess);
+ $nper = (int) Functions::flattenSingleValue($nper);
+ $pmt = Functions::flattenSingleValue($pmt);
+ $pv = Functions::flattenSingleValue($pv);
+ $fv = (is_null($fv)) ? 0.0 : Functions::flattenSingleValue($fv);
+ $type = (is_null($type)) ? 0 : (int) Functions::flattenSingleValue($type);
+ $guess = (is_null($guess)) ? 0.1 : Functions::flattenSingleValue($guess);
$rate = $guess;
if (abs($rate) < FINANCIAL_PRECISION) {
@@ -1918,18 +1918,18 @@ class Financial
*/
public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $investment = (float) PHPExcel_Calculation_Functions::flattenSingleValue($investment);
- $discount = (float) PHPExcel_Calculation_Functions::flattenSingleValue($discount);
- $basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $investment = (float) Functions::flattenSingleValue($investment);
+ $discount = (float) Functions::flattenSingleValue($discount);
+ $basis = (int) Functions::flattenSingleValue($basis);
// Validate
if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) {
if (($investment <= 0) || ($discount <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@@ -1937,7 +1937,7 @@ class Financial
return $investment / ( 1 - ($discount * $daysBetweenSettlementAndMaturity));
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1953,18 +1953,18 @@ class Financial
*/
public static function SLN($cost, $salvage, $life)
{
- $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
- $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
- $life = PHPExcel_Calculation_Functions::flattenSingleValue($life);
+ $cost = Functions::flattenSingleValue($cost);
+ $salvage = Functions::flattenSingleValue($salvage);
+ $life = Functions::flattenSingleValue($life);
// Calculate
if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life))) {
if ($life < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return ($cost - $salvage) / $life;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1981,19 +1981,19 @@ class Financial
*/
public static function SYD($cost, $salvage, $life, $period)
{
- $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
- $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
- $life = PHPExcel_Calculation_Functions::flattenSingleValue($life);
- $period = PHPExcel_Calculation_Functions::flattenSingleValue($period);
+ $cost = Functions::flattenSingleValue($cost);
+ $salvage = Functions::flattenSingleValue($salvage);
+ $life = Functions::flattenSingleValue($life);
+ $period = Functions::flattenSingleValue($period);
// Calculate
if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period))) {
if (($life < 1) || ($period > $life)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return (($cost - $salvage) * ($life - $period + 1) * 2) / ($life * ($life + 1));
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2011,9 +2011,9 @@ class Financial
*/
public static function TBILLEQ($settlement, $maturity, $discount)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $discount = PHPExcel_Calculation_Functions::flattenSingleValue($discount);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $discount = Functions::flattenSingleValue($discount);
// Use TBILLPRICE for validation
$testValue = self::TBILLPRICE($settlement, $maturity, $discount);
@@ -2021,15 +2021,15 @@ class Financial
return $testValue;
}
- if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($maturity = DateTime::getDateValue($maturity))) {
+ return Functions::VALUE();
}
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
++$maturity;
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity) * 360;
} else {
- $daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::getDateValue($maturity) - PHPExcel_Calculation_DateTime::getDateValue($settlement));
+ $daysBetweenSettlementAndMaturity = (DateTime::getDateValue($maturity) - DateTime::getDateValue($settlement));
}
return (365 * $discount) / (360 - $discount * $daysBetweenSettlementAndMaturity);
@@ -2050,42 +2050,42 @@ class Financial
*/
public static function TBILLPRICE($settlement, $maturity, $discount)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $discount = PHPExcel_Calculation_Functions::flattenSingleValue($discount);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $discount = Functions::flattenSingleValue($discount);
- if (is_string($maturity = PHPExcel_Calculation_DateTime::getDateValue($maturity))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ if (is_string($maturity = DateTime::getDateValue($maturity))) {
+ return Functions::VALUE();
}
// Validate
if (is_numeric($discount)) {
if ($discount <= 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
++$maturity;
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity) * 360;
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
} else {
- $daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::getDateValue($maturity) - PHPExcel_Calculation_DateTime::getDateValue($settlement));
+ $daysBetweenSettlementAndMaturity = (DateTime::getDateValue($maturity) - DateTime::getDateValue($settlement));
}
if ($daysBetweenSettlementAndMaturity > 360) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$price = 100 * (1 - (($discount * $daysBetweenSettlementAndMaturity) / 360));
if ($price <= 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return $price;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2103,47 +2103,47 @@ class Financial
*/
public static function TBILLYIELD($settlement, $maturity, $price)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $price = PHPExcel_Calculation_Functions::flattenSingleValue($price);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $price = Functions::flattenSingleValue($price);
// Validate
if (is_numeric($price)) {
if ($price <= 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
++$maturity;
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity) * 360;
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
} else {
- $daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::getDateValue($maturity) - PHPExcel_Calculation_DateTime::getDateValue($settlement));
+ $daysBetweenSettlementAndMaturity = (DateTime::getDateValue($maturity) - DateTime::getDateValue($settlement));
}
if ($daysBetweenSettlementAndMaturity > 360) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return ((100 - $price) / $price) * (360 / $daysBetweenSettlementAndMaturity);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
public static function XIRR($values, $dates, $guess = 0.1)
{
if ((!is_array($values)) && (!is_array($dates))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
- $values = PHPExcel_Calculation_Functions::flattenArray($values);
- $dates = PHPExcel_Calculation_Functions::flattenArray($dates);
- $guess = PHPExcel_Calculation_Functions::flattenSingleValue($guess);
+ $values = Functions::flattenArray($values);
+ $dates = Functions::flattenArray($dates);
+ $guess = Functions::flattenSingleValue($guess);
if (count($values) != count($dates)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// create an initial range, with a root somewhere between 0 and guess
@@ -2161,7 +2161,7 @@ class Financial
}
}
if (($f1 * $f2) > 0.0) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$f = self::XNPV($x1, $values, $dates);
@@ -2184,7 +2184,7 @@ class Financial
return $x_mid;
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2209,31 +2209,31 @@ class Financial
*/
public static function XNPV($rate, $values, $dates)
{
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
+ $rate = Functions::flattenSingleValue($rate);
if (!is_numeric($rate)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if ((!is_array($values)) || (!is_array($dates))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
- $values = PHPExcel_Calculation_Functions::flattenArray($values);
- $dates = PHPExcel_Calculation_Functions::flattenArray($dates);
+ $values = Functions::flattenArray($values);
+ $dates = Functions::flattenArray($dates);
$valCount = count($values);
if ($valCount != count($dates)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ((min($values) > 0) || (max($values) < 0)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$xnpv = 0.0;
for ($i = 0; $i < $valCount; ++$i) {
if (!is_numeric($values[$i])) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
- $xnpv += $values[$i] / pow(1 + $rate, PHPExcel_Calculation_DateTime::DATEDIF($dates[0], $dates[$i], 'd') / 365);
+ $xnpv += $values[$i] / pow(1 + $rate, DateTime::DATEDIF($dates[0], $dates[$i], 'd') / 365);
}
- return (is_finite($xnpv)) ? $xnpv : PHPExcel_Calculation_Functions::VALUE();
+ return (is_finite($xnpv)) ? $xnpv : Functions::VALUE();
}
@@ -2258,22 +2258,22 @@ class Financial
*/
public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $price = PHPExcel_Calculation_Functions::flattenSingleValue($price);
- $redemption = PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
- $basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $settlement = Functions::flattenSingleValue($settlement);
+ $maturity = Functions::flattenSingleValue($maturity);
+ $price = Functions::flattenSingleValue($price);
+ $redemption = Functions::flattenSingleValue($redemption);
+ $basis = (int) Functions::flattenSingleValue($basis);
// Validate
if (is_numeric($price) && is_numeric($redemption)) {
if (($price <= 0) || ($redemption <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
+ $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis);
if (!is_numeric($daysPerYear)) {
return $daysPerYear;
}
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@@ -2282,7 +2282,7 @@ class Financial
return (($redemption - $price) / $price) * ($daysPerYear / $daysBetweenSettlementAndMaturity);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2308,35 +2308,35 @@ class Financial
*/
public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0)
{
- $settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
- $maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
- $issue = PHPExcel_Calculation_Functions::flattenSingleValue($issue);
- $rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
- $price = PHPExcel_Calculation_Functions::flattenSingleValue($price);
- $basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
+ $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 PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- $daysPerYear = self::daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
+ $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis);
if (!is_numeric($daysPerYear)) {
return $daysPerYear;
}
- $daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
+ $daysBetweenIssueAndSettlement = DateTime::YEARFRAC($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
}
$daysBetweenIssueAndSettlement *= $daysPerYear;
- $daysBetweenIssueAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $maturity, $basis);
+ $daysBetweenIssueAndMaturity = DateTime::YEARFRAC($issue, $maturity, $basis);
if (!is_numeric($daysBetweenIssueAndMaturity)) {
// return date error
return $daysBetweenIssueAndMaturity;
}
$daysBetweenIssueAndMaturity *= $daysPerYear;
- $daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
+ $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
@@ -2347,6 +2347,6 @@ class Financial
(($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) *
($daysPerYear / $daysBetweenSettlementAndMaturity);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
diff --git a/classes/src/Calculation/Functions.php b/classes/src/Calculation/Functions.php
index 3474d99c..2505f758 100644
--- a/classes/src/Calculation/Functions.php
+++ b/classes/src/Calculation/Functions.php
@@ -42,7 +42,6 @@ define('PRECISION', 8.88E-016);
*/
class Functions
{
-
/** constants */
const COMPATIBILITY_EXCEL = 'Excel';
const COMPATIBILITY_GNUMERIC = 'Gnumeric';
@@ -94,9 +93,9 @@ class Functions
* @category Function Configuration
* @param string $compatibilityMode Compatibility Mode
* Permitted values are:
- * PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL 'Excel'
- * PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric'
- * PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc'
+ * Functions::COMPATIBILITY_EXCEL 'Excel'
+ * Functions::COMPATIBILITY_GNUMERIC 'Gnumeric'
+ * Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc'
* @return boolean (Success or Failure)
*/
public static function setCompatibilityMode($compatibilityMode)
@@ -118,9 +117,9 @@ class Functions
* @category Function Configuration
* @return string Compatibility Mode
* Possible Return values are:
- * PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL 'Excel'
- * PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric'
- * PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc'
+ * Functions::COMPATIBILITY_EXCEL 'Excel'
+ * Functions::COMPATIBILITY_GNUMERIC 'Gnumeric'
+ * Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc'
*/
public static function getCompatibilityMode()
{
@@ -135,9 +134,9 @@ class Functions
* @category Function Configuration
* @param string $returnDateType Return Date Format
* Permitted values are:
- * PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P'
- * PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT 'O'
- * PHPExcel_Calculation_Functions::RETURNDATE_EXCEL 'E'
+ * Functions::RETURNDATE_PHP_NUMERIC 'P'
+ * Functions::RETURNDATE_PHP_OBJECT 'O'
+ * Functions::RETURNDATE_EXCEL 'E'
* @return boolean Success or failure
*/
public static function setReturnDateType($returnDateType)
@@ -159,9 +158,9 @@ class Functions
* @category Function Configuration
* @return string Return Date Format
* Possible Return values are:
- * PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P'
- * PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT 'O'
- * PHPExcel_Calculation_Functions::RETURNDATE_EXCEL 'E'
+ * Functions::RETURNDATE_PHP_NUMERIC 'P'
+ * Functions::RETURNDATE_PHP_OBJECT 'O'
+ * Functions::RETURNDATE_EXCEL 'E'
*/
public static function getReturnDateType()
{
@@ -309,7 +308,7 @@ class Functions
public static function ifCondition($condition)
{
- $condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
+ $condition = Functions::flattenSingleValue($condition);
if (!isset($condition{0})) {
$condition = '=""';
}
diff --git a/classes/src/Calculation/Logical.php b/classes/src/Calculation/Logical.php
index eb676592..537f0813 100644
--- a/classes/src/Calculation/Logical.php
+++ b/classes/src/Calculation/Logical.php
@@ -92,7 +92,7 @@ class PHPExcel_Calculation_Logical
$returnValue = true;
// Loop through the arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
$argCount = -1;
foreach ($aArgs as $argCount => $arg) {
// Is it a boolean value?
@@ -107,7 +107,7 @@ class PHPExcel_Calculation_Logical
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
$arg = false;
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$returnValue = $returnValue && ($arg != 0);
}
@@ -115,7 +115,7 @@ class PHPExcel_Calculation_Logical
// Return
if ($argCount < 0) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
return $returnValue;
}
@@ -148,7 +148,7 @@ class PHPExcel_Calculation_Logical
$returnValue = false;
// Loop through the arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
$argCount = -1;
foreach ($aArgs as $argCount => $arg) {
// Is it a boolean value?
@@ -163,7 +163,7 @@ class PHPExcel_Calculation_Logical
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
$arg = false;
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$returnValue = $returnValue || ($arg != 0);
}
@@ -171,7 +171,7 @@ class PHPExcel_Calculation_Logical
// Return
if ($argCount < 0) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
return $returnValue;
}
@@ -199,7 +199,7 @@ class PHPExcel_Calculation_Logical
*/
public static function NOT($logical = false)
{
- $logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical);
+ $logical = Functions::flattenSingleValue($logical);
if (is_string($logical)) {
$logical = strtoupper($logical);
if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) {
@@ -207,7 +207,7 @@ class PHPExcel_Calculation_Logical
} elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) {
return true;
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
@@ -248,9 +248,9 @@ class PHPExcel_Calculation_Logical
*/
public static function STATEMENT_IF($condition = true, $returnIfTrue = 0, $returnIfFalse = false)
{
- $condition = (is_null($condition)) ? true : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition);
- $returnIfTrue = (is_null($returnIfTrue)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue);
- $returnIfFalse = (is_null($returnIfFalse)) ? false : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse);
+ $condition = (is_null($condition)) ? true : (boolean) Functions::flattenSingleValue($condition);
+ $returnIfTrue = (is_null($returnIfTrue)) ? 0 : Functions::flattenSingleValue($returnIfTrue);
+ $returnIfFalse = (is_null($returnIfFalse)) ? false : Functions::flattenSingleValue($returnIfFalse);
return ($condition) ? $returnIfTrue : $returnIfFalse;
}
@@ -270,9 +270,9 @@ class PHPExcel_Calculation_Logical
*/
public static function IFERROR($testValue = '', $errorpart = '')
{
- $testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
- $errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart);
+ $testValue = (is_null($testValue)) ? '' : Functions::flattenSingleValue($testValue);
+ $errorpart = (is_null($errorpart)) ? '' : Functions::flattenSingleValue($errorpart);
- return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue);
+ return self::STATEMENT_IF(Functions::IS_ERROR($testValue), $errorpart, $testValue);
}
}
diff --git a/classes/src/Calculation/LookupRef.php b/classes/src/Calculation/LookupRef.php
index 76f00866..6c76ace7 100644
--- a/classes/src/Calculation/LookupRef.php
+++ b/classes/src/Calculation/LookupRef.php
@@ -52,13 +52,13 @@ class LookupRef
*/
public static function CELL_ADDRESS($row, $column, $relativity = 1, $referenceStyle = true, $sheetText = '')
{
- $row = PHPExcel_Calculation_Functions::flattenSingleValue($row);
- $column = PHPExcel_Calculation_Functions::flattenSingleValue($column);
- $relativity = PHPExcel_Calculation_Functions::flattenSingleValue($relativity);
- $sheetText = PHPExcel_Calculation_Functions::flattenSingleValue($sheetText);
+ $row = Functions::flattenSingleValue($row);
+ $column = Functions::flattenSingleValue($column);
+ $relativity = Functions::flattenSingleValue($relativity);
+ $sheetText = Functions::flattenSingleValue($sheetText);
if (($row < 1) || ($column < 1)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if ($sheetText > '') {
@@ -151,7 +151,7 @@ class LookupRef
if (is_null($cellAddress) || $cellAddress === '') {
return 1;
} elseif (!is_array($cellAddress)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
reset($cellAddress);
@@ -229,7 +229,7 @@ class LookupRef
if (is_null($cellAddress) || $cellAddress === '') {
return 1;
} elseif (!is_array($cellAddress)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
reset($cellAddress);
@@ -262,11 +262,11 @@ class LookupRef
$args = func_get_args();
$pCell = array_pop($args);
- $linkURL = (is_null($linkURL)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($linkURL);
- $displayName = (is_null($displayName)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($displayName);
+ $linkURL = (is_null($linkURL)) ? '' : Functions::flattenSingleValue($linkURL);
+ $displayName = (is_null($displayName)) ? '' : Functions::flattenSingleValue($displayName);
if ((!is_object($pCell)) || (trim($linkURL) == '')) {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
}
if ((is_object($displayName)) || trim($displayName) == '') {
@@ -299,9 +299,9 @@ class LookupRef
*/
public static function INDIRECT($cellAddress = null, PHPExcel_Cell $pCell = null)
{
- $cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress);
+ $cellAddress = Functions::flattenSingleValue($cellAddress);
if (is_null($cellAddress) || $cellAddress === '') {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
}
$cellAddress1 = $cellAddress;
@@ -313,7 +313,7 @@ class LookupRef
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) {
if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
}
if (strpos($cellAddress, '!') !== false) {
@@ -366,10 +366,10 @@ class LookupRef
*/
public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null)
{
- $rows = PHPExcel_Calculation_Functions::flattenSingleValue($rows);
- $columns = PHPExcel_Calculation_Functions::flattenSingleValue($columns);
- $height = PHPExcel_Calculation_Functions::flattenSingleValue($height);
- $width = PHPExcel_Calculation_Functions::flattenSingleValue($width);
+ $rows = Functions::flattenSingleValue($rows);
+ $columns = Functions::flattenSingleValue($columns);
+ $height = Functions::flattenSingleValue($height);
+ $width = Functions::flattenSingleValue($width);
if ($cellAddress == null) {
return 0;
}
@@ -377,7 +377,7 @@ class LookupRef
$args = func_get_args();
$pCell = array_pop($args);
if (!is_object($pCell)) {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
}
$sheetName = null;
@@ -398,7 +398,7 @@ class LookupRef
$startCellColumn += $columns;
if (($startCellRow <= 0) || ($startCellColumn < 0)) {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
}
$endCellColumn = PHPExcel_Cell::columnIndexFromString($endCellColumn) - 1;
if (($width != null) && (!is_object($width))) {
@@ -415,7 +415,7 @@ class LookupRef
}
if (($endCellRow <= 0) || ($endCellColumn < 0)) {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
}
$endCellColumn = PHPExcel_Cell::stringFromColumnIndex($endCellColumn);
@@ -455,7 +455,7 @@ class LookupRef
public static function CHOOSE()
{
$chooseArgs = func_get_args();
- $chosenEntry = PHPExcel_Calculation_Functions::flattenArray(array_shift($chooseArgs));
+ $chosenEntry = Functions::flattenArray(array_shift($chooseArgs));
$entryCount = count($chooseArgs) - 1;
if (is_array($chosenEntry)) {
@@ -464,15 +464,15 @@ class LookupRef
if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) {
--$chosenEntry;
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$chosenEntry = floor($chosenEntry);
if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (is_array($chooseArgs[$chosenEntry])) {
- return PHPExcel_Calculation_Functions::flattenArray($chooseArgs[$chosenEntry]);
+ return Functions::flattenArray($chooseArgs[$chosenEntry]);
} else {
return $chooseArgs[$chosenEntry];
}
@@ -494,26 +494,26 @@ class LookupRef
*/
public static function MATCH($lookup_value, $lookup_array, $match_type = 1)
{
- $lookup_array = PHPExcel_Calculation_Functions::flattenArray($lookup_array);
- $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
- $match_type = (is_null($match_type)) ? 1 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($match_type);
+ $lookup_array = Functions::flattenArray($lookup_array);
+ $lookup_value = Functions::flattenSingleValue($lookup_value);
+ $match_type = (is_null($match_type)) ? 1 : (int) Functions::flattenSingleValue($match_type);
// MATCH is not case sensitive
$lookup_value = strtolower($lookup_value);
// lookup_value type has to be number, text, or logical values
if ((!is_numeric($lookup_value)) && (!is_string($lookup_value)) && (!is_bool($lookup_value))) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
// match_type is 0, 1 or -1
if (($match_type !== 0) && ($match_type !== -1) && ($match_type !== 1)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
// lookup_array should not be empty
$lookupArraySize = count($lookup_array);
if ($lookupArraySize <= 0) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
// lookup_array should contain only number, text, or logical values, or empty (null) cells
@@ -521,7 +521,7 @@ class LookupRef
// check the type of the value
if ((!is_numeric($lookupArrayValue)) && (!is_string($lookupArrayValue)) &&
(!is_bool($lookupArrayValue)) && (!is_null($lookupArrayValue))) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
// convert strings to lowercase for case-insensitive testing
if (is_string($lookupArrayValue)) {
@@ -572,7 +572,7 @@ class LookupRef
}
// unsuccessful in finding a match, return #N/A error value
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
@@ -592,18 +592,18 @@ class LookupRef
public static function INDEX($arrayValues, $rowNum = 0, $columnNum = 0)
{
if (($rowNum < 0) || ($columnNum < 0)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (!is_array($arrayValues)) {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
}
$rowKeys = array_keys($arrayValues);
$columnKeys = @array_keys($arrayValues[$rowKeys[0]]);
if ($columnNum > count($columnKeys)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif ($columnNum == 0) {
if ($rowNum == 0) {
return $arrayValues;
@@ -625,7 +625,7 @@ class LookupRef
}
$columnNum = $columnKeys[--$columnNum];
if ($rowNum > count($rowKeys)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif ($rowNum == 0) {
return $arrayValues[$columnNum];
}
@@ -685,23 +685,23 @@ class LookupRef
*/
public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true)
{
- $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
- $index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
- $not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
+ $lookup_value = Functions::flattenSingleValue($lookup_value);
+ $index_number = Functions::flattenSingleValue($index_number);
+ $not_exact_match = Functions::flattenSingleValue($not_exact_match);
// index_number must be greater than or equal to 1
if ($index_number < 1) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
// index_number must be less than or equal to the number of columns in lookup_array
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
} else {
$f = array_keys($lookup_array);
$firstRow = array_pop($f);
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
} else {
$columnKeys = array_keys($lookup_array[$firstRow]);
$returnColumn = $columnKeys[--$index_number];
@@ -726,14 +726,14 @@ class LookupRef
if ($rowNumber !== false) {
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
// if an exact match is required, we have what we need to return an appropriate response
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} else {
// otherwise return the appropriate value
return $lookup_array[$rowNumber][$returnColumn];
}
}
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
@@ -748,23 +748,23 @@ class LookupRef
*/
public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true)
{
- $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
- $index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
- $not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
+ $lookup_value = Functions::flattenSingleValue($lookup_value);
+ $index_number = Functions::flattenSingleValue($index_number);
+ $not_exact_match = Functions::flattenSingleValue($not_exact_match);
// index_number must be greater than or equal to 1
if ($index_number < 1) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
// index_number must be less than or equal to the number of columns in lookup_array
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
} else {
$f = array_keys($lookup_array);
$firstRow = array_pop($f);
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
- return PHPExcel_Calculation_Functions::REF();
+ return Functions::REF();
} else {
$columnKeys = array_keys($lookup_array[$firstRow]);
$firstkey = $f[0] - 1;
@@ -790,14 +790,14 @@ class LookupRef
if ($rowNumber !== false) {
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
// if an exact match is required, we have what we need to return an appropriate response
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} else {
// otherwise return the appropriate value
return $lookup_array[$returnColumn][$rowNumber];
}
}
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
@@ -811,10 +811,10 @@ class LookupRef
*/
public static function LOOKUP($lookup_value, $lookup_vector, $result_vector = null)
{
- $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
+ $lookup_value = Functions::flattenSingleValue($lookup_value);
if (!is_array($lookup_vector)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
$lookupRows = count($lookup_vector);
$l = array_keys($lookup_vector);
diff --git a/classes/src/Calculation/MathTrig.php b/classes/src/Calculation/MathTrig.php
index 3fc7fdca..fb4f9c06 100644
--- a/classes/src/Calculation/MathTrig.php
+++ b/classes/src/Calculation/MathTrig.php
@@ -85,8 +85,8 @@ class MathTrig
*/
public static function ATAN2($xCoordinate = null, $yCoordinate = null)
{
- $xCoordinate = PHPExcel_Calculation_Functions::flattenSingleValue($xCoordinate);
- $yCoordinate = PHPExcel_Calculation_Functions::flattenSingleValue($yCoordinate);
+ $xCoordinate = Functions::flattenSingleValue($xCoordinate);
+ $yCoordinate = Functions::flattenSingleValue($yCoordinate);
$xCoordinate = ($xCoordinate !== null) ? $xCoordinate : 0.0;
$yCoordinate = ($yCoordinate !== null) ? $yCoordinate : 0.0;
@@ -97,12 +97,12 @@ class MathTrig
$yCoordinate = (float) $yCoordinate;
if (($xCoordinate == 0) && ($yCoordinate == 0)) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
return atan2($yCoordinate, $xCoordinate);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -125,11 +125,11 @@ class MathTrig
*/
public static function CEILING($number, $significance = null)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
- $significance = PHPExcel_Calculation_Functions::flattenSingleValue($significance);
+ $number = Functions::flattenSingleValue($number);
+ $significance = Functions::flattenSingleValue($significance);
if ((is_null($significance)) &&
- (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
+ (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) {
$significance = $number / abs($number);
}
@@ -139,10 +139,10 @@ class MathTrig
} elseif (self::SIGN($number) == self::SIGN($significance)) {
return ceil($number / $significance) * $significance;
} else {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -163,18 +163,18 @@ class MathTrig
*/
public static function COMBIN($numObjs, $numInSet)
{
- $numObjs = PHPExcel_Calculation_Functions::flattenSingleValue($numObjs);
- $numInSet = PHPExcel_Calculation_Functions::flattenSingleValue($numInSet);
+ $numObjs = Functions::flattenSingleValue($numObjs);
+ $numInSet = Functions::flattenSingleValue($numInSet);
if ((is_numeric($numObjs)) && (is_numeric($numInSet))) {
if ($numObjs < $numInSet) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif ($numInSet < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return round(self::FACT($numObjs) / self::FACT($numObjs - $numInSet)) / self::FACT($numInSet);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -197,7 +197,7 @@ class MathTrig
*/
public static function EVEN($number)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
+ $number = Functions::flattenSingleValue($number);
if (is_null($number)) {
return 0;
@@ -209,7 +209,7 @@ class MathTrig
$significance = 2 * self::SIGN($number);
return (int) self::CEILING($number, $significance);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -229,16 +229,16 @@ class MathTrig
*/
public static function FACT($factVal)
{
- $factVal = PHPExcel_Calculation_Functions::flattenSingleValue($factVal);
+ $factVal = Functions::flattenSingleValue($factVal);
if (is_numeric($factVal)) {
if ($factVal < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$factLoop = floor($factVal);
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
if ($factVal > $factLoop) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
}
@@ -248,7 +248,7 @@ class MathTrig
}
return $factorial ;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -267,12 +267,12 @@ class MathTrig
*/
public static function FACTDOUBLE($factVal)
{
- $factLoop = PHPExcel_Calculation_Functions::flattenSingleValue($factVal);
+ $factLoop = Functions::flattenSingleValue($factVal);
if (is_numeric($factLoop)) {
$factLoop = floor($factLoop);
if ($factVal < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$factorial = 1;
while ($factLoop > 1) {
@@ -281,7 +281,7 @@ class MathTrig
}
return $factorial ;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -301,27 +301,27 @@ class MathTrig
*/
public static function FLOOR($number, $significance = null)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
- $significance = PHPExcel_Calculation_Functions::flattenSingleValue($significance);
+ $number = Functions::flattenSingleValue($number);
+ $significance = Functions::flattenSingleValue($significance);
if ((is_null($significance)) &&
- (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
+ (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) {
$significance = $number/abs($number);
}
if ((is_numeric($number)) && (is_numeric($significance))) {
if ($significance == 0.0) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
} elseif ($number == 0.0) {
return 0.0;
} elseif (self::SIGN($number) == self::SIGN($significance)) {
return floor($number / $significance) * $significance;
} else {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -345,13 +345,13 @@ class MathTrig
$returnValue = 1;
$allValuesFactors = array();
// Loop through arguments
- foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $value) {
+ foreach (Functions::flattenArray(func_get_args()) as $value) {
if (!is_numeric($value)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif ($value == 0) {
continue;
} elseif ($value < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$myFactors = self::factors($value);
$myCountedFactors = array_count_values($myFactors);
@@ -417,7 +417,7 @@ class MathTrig
*/
public static function INT($number)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
+ $number = Functions::flattenSingleValue($number);
if (is_null($number)) {
return 0;
@@ -427,7 +427,7 @@ class MathTrig
if (is_numeric($number)) {
return (int) floor($number);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -452,14 +452,14 @@ class MathTrig
$returnValue = 1;
$allPoweredFactors = array();
// Loop through arguments
- foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $value) {
+ foreach (Functions::flattenArray(func_get_args()) as $value) {
if (!is_numeric($value)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if ($value == 0) {
return 0;
} elseif ($value < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$myFactors = self::factors(floor($value));
$myCountedFactors = array_count_values($myFactors);
@@ -500,14 +500,14 @@ class MathTrig
*/
public static function LOG_BASE($number = null, $base = 10)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
- $base = (is_null($base)) ? 10 : (float) PHPExcel_Calculation_Functions::flattenSingleValue($base);
+ $number = Functions::flattenSingleValue($number);
+ $base = (is_null($base)) ? 10 : (float) Functions::flattenSingleValue($base);
if ((!is_numeric($base)) || (!is_numeric($number))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (($base <= 0) || ($number <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return log($number, $base);
}
@@ -541,7 +541,7 @@ class MathTrig
$column = 0;
foreach ($matrixRow as $matrixCell) {
if ((is_string($matrixCell)) || ($matrixCell === null)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$matrixData[$column][$row] = $matrixCell;
++$column;
@@ -552,14 +552,14 @@ class MathTrig
++$row;
}
if ($row != $maxColumn) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
try {
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
return $matrix->det();
} catch (PHPExcel_Exception $ex) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
@@ -592,7 +592,7 @@ class MathTrig
$column = 0;
foreach ($matrixRow as $matrixCell) {
if ((is_string($matrixCell)) || ($matrixCell === null)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$matrixData[$column][$row] = $matrixCell;
++$column;
@@ -603,14 +603,14 @@ class MathTrig
++$row;
}
if ($row != $maxColumn) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
try {
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
return $matrix->inverse()->getArray();
} catch (PHPExcel_Exception $ex) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
@@ -641,7 +641,7 @@ class MathTrig
$columnA = 0;
foreach ($matrixRow as $matrixCell) {
if ((!is_numeric($matrixCell)) || ($matrixCell === null)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$matrixAData[$rowA][$columnA] = $matrixCell;
++$columnA;
@@ -657,7 +657,7 @@ class MathTrig
$columnB = 0;
foreach ($matrixRow as $matrixCell) {
if ((!is_numeric($matrixCell)) || ($matrixCell === null)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$matrixBData[$rowB][$columnB] = $matrixCell;
++$columnB;
@@ -667,13 +667,13 @@ class MathTrig
$matrixB = new PHPExcel_Shared_JAMA_Matrix($matrixBData);
if ($columnA != $rowB) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
return $matrixA->times($matrixB)->getArray();
} catch (PHPExcel_Exception $ex) {
var_dump($ex->getMessage());
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
@@ -687,11 +687,11 @@ class MathTrig
*/
public static function MOD($a = 1, $b = 1)
{
- $a = PHPExcel_Calculation_Functions::flattenSingleValue($a);
- $b = PHPExcel_Calculation_Functions::flattenSingleValue($b);
+ $a = Functions::flattenSingleValue($a);
+ $b = Functions::flattenSingleValue($b);
if ($b == 0.0) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
} elseif (($a < 0.0) && ($b > 0.0)) {
return $b - fmod(abs($a), $b);
} elseif (($a > 0.0) && ($b < 0.0)) {
@@ -713,8 +713,8 @@ class MathTrig
*/
public static function MROUND($number, $multiple)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
- $multiple = PHPExcel_Calculation_Functions::flattenSingleValue($multiple);
+ $number = Functions::flattenSingleValue($number);
+ $multiple = Functions::flattenSingleValue($multiple);
if ((is_numeric($number)) && (is_numeric($multiple))) {
if ($multiple == 0) {
@@ -724,9 +724,9 @@ class MathTrig
$multiplier = 1 / $multiple;
return round($number * $multiplier) / $multiplier;
}
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -743,16 +743,16 @@ class MathTrig
$summer = 0;
$divisor = 1;
// Loop through arguments
- foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
+ foreach (Functions::flattenArray(func_get_args()) as $arg) {
// Is it a numeric value?
if (is_numeric($arg)) {
if ($arg < 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$summer += floor($arg);
$divisor *= self::FACT($arg);
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
@@ -775,7 +775,7 @@ class MathTrig
*/
public static function ODD($number)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
+ $number = Functions::flattenSingleValue($number);
if (is_null($number)) {
return 1;
@@ -794,7 +794,7 @@ class MathTrig
return (int) $result;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -809,19 +809,19 @@ class MathTrig
*/
public static function POWER($x = 0, $y = 2)
{
- $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
- $y = PHPExcel_Calculation_Functions::flattenSingleValue($y);
+ $x = Functions::flattenSingleValue($x);
+ $y = Functions::flattenSingleValue($y);
// Validate parameters
if ($x == 0.0 && $y == 0.0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif ($x == 0.0 && $y < 0.0) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
// Return
$result = pow($x, $y);
- return (!is_nan($result) && !is_infinite($result)) ? $result : PHPExcel_Calculation_Functions::NaN();
+ return (!is_nan($result) && !is_infinite($result)) ? $result : Functions::NaN();
}
@@ -844,7 +844,7 @@ class MathTrig
$returnValue = null;
// Loop through arguments
- foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
+ foreach (Functions::flattenArray(func_get_args()) as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
if (is_null($returnValue)) {
@@ -883,7 +883,7 @@ class MathTrig
$returnValue = null;
// Loop through arguments
- foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
+ foreach (Functions::flattenArray(func_get_args()) as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
if (is_null($returnValue)) {
@@ -912,8 +912,8 @@ class MathTrig
*/
public static function RAND($min = 0, $max = 0)
{
- $min = PHPExcel_Calculation_Functions::flattenSingleValue($min);
- $max = PHPExcel_Calculation_Functions::flattenSingleValue($max);
+ $min = Functions::flattenSingleValue($min);
+ $max = Functions::flattenSingleValue($max);
if ($min == 0 && $max == 0) {
return (mt_rand(0, 10000000)) / 10000000;
@@ -925,10 +925,10 @@ class MathTrig
public static function ROMAN($aValue, $style = 0)
{
- $aValue = PHPExcel_Calculation_Functions::flattenSingleValue($aValue);
- $style = (is_null($style)) ? 0 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($style);
+ $aValue = Functions::flattenSingleValue($aValue);
+ $style = (is_null($style)) ? 0 : (integer) Functions::flattenSingleValue($style);
if ((!is_numeric($aValue)) || ($aValue < 0) || ($aValue >= 4000)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$aValue = (integer) $aValue;
if ($aValue == 0) {
@@ -967,8 +967,8 @@ class MathTrig
*/
public static function ROUNDUP($number, $digits)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
- $digits = PHPExcel_Calculation_Functions::flattenSingleValue($digits);
+ $number = Functions::flattenSingleValue($number);
+ $digits = Functions::flattenSingleValue($digits);
if ((is_numeric($number)) && (is_numeric($digits))) {
$significance = pow(10, (int) $digits);
@@ -978,7 +978,7 @@ class MathTrig
return ceil($number * $significance) / $significance;
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -993,8 +993,8 @@ class MathTrig
*/
public static function ROUNDDOWN($number, $digits)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
- $digits = PHPExcel_Calculation_Functions::flattenSingleValue($digits);
+ $number = Functions::flattenSingleValue($number);
+ $digits = Functions::flattenSingleValue($digits);
if ((is_numeric($number)) && (is_numeric($digits))) {
$significance = pow(10, (int) $digits);
@@ -1004,7 +1004,7 @@ class MathTrig
return floor($number * $significance) / $significance;
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1024,7 +1024,7 @@ class MathTrig
$returnValue = 0;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
$x = array_shift($aArgs);
$n = array_shift($aArgs);
@@ -1038,12 +1038,12 @@ class MathTrig
if ((is_numeric($arg)) && (!is_string($arg))) {
$returnValue += $arg * pow($x, $n + ($m * $i++));
} else {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
}
return $returnValue;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1058,7 +1058,7 @@ class MathTrig
*/
public static function SIGN($number)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
+ $number = Functions::flattenSingleValue($number);
if (is_bool($number)) {
return (int) $number;
@@ -1069,7 +1069,7 @@ class MathTrig
}
return $number / abs($number);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1083,15 +1083,15 @@ class MathTrig
*/
public static function SQRTPI($number)
{
- $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
+ $number = Functions::flattenSingleValue($number);
if (is_numeric($number)) {
if ($number < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return sqrt($number * M_PI) ;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1107,7 +1107,7 @@ class MathTrig
*/
public static function SUBTOTAL()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
// Calculate
$subtotal = array_shift($aArgs);
@@ -1115,30 +1115,30 @@ class MathTrig
if ((is_numeric($subtotal)) && (!is_string($subtotal))) {
switch ($subtotal) {
case 1:
- return PHPExcel_Calculation_Statistical::AVERAGE($aArgs);
+ return Statistical::AVERAGE($aArgs);
case 2:
- return PHPExcel_Calculation_Statistical::COUNT($aArgs);
+ return Statistical::COUNT($aArgs);
case 3:
- return PHPExcel_Calculation_Statistical::COUNTA($aArgs);
+ return Statistical::COUNTA($aArgs);
case 4:
- return PHPExcel_Calculation_Statistical::MAX($aArgs);
+ return Statistical::MAX($aArgs);
case 5:
- return PHPExcel_Calculation_Statistical::MIN($aArgs);
+ return Statistical::MIN($aArgs);
case 6:
return self::PRODUCT($aArgs);
case 7:
- return PHPExcel_Calculation_Statistical::STDEV($aArgs);
+ return Statistical::STDEV($aArgs);
case 8:
- return PHPExcel_Calculation_Statistical::STDEVP($aArgs);
+ return Statistical::STDEVP($aArgs);
case 9:
return self::SUM($aArgs);
case 10:
- return PHPExcel_Calculation_Statistical::VARFunc($aArgs);
+ return Statistical::VARFunc($aArgs);
case 11:
- return PHPExcel_Calculation_Statistical::VARP($aArgs);
+ return Statistical::VARP($aArgs);
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1160,7 +1160,7 @@ class MathTrig
$returnValue = 0;
// Loop through the arguments
- foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
+ foreach (Functions::flattenArray(func_get_args()) as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
$returnValue += $arg;
@@ -1189,12 +1189,12 @@ class MathTrig
{
$returnValue = 0;
- $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
- $sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs);
+ $aArgs = Functions::flattenArray($aArgs);
+ $sumArgs = Functions::flattenArray($sumArgs);
if (empty($sumArgs)) {
$sumArgs = $aArgs;
}
- $condition = PHPExcel_Calculation_Functions::ifCondition($condition);
+ $condition = Functions::ifCondition($condition);
// Loop through arguments
foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) {
@@ -1228,7 +1228,7 @@ class MathTrig
{
$arrayList = func_get_args();
- $wrkArray = PHPExcel_Calculation_Functions::flattenArray(array_shift($arrayList));
+ $wrkArray = Functions::flattenArray(array_shift($arrayList));
$wrkCellCount = count($wrkArray);
for ($i=0; $i< $wrkCellCount; ++$i) {
@@ -1238,10 +1238,10 @@ class MathTrig
}
foreach ($arrayList as $matrixData) {
- $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData);
+ $array2 = Functions::flattenArray($matrixData);
$count = count($array2);
if ($wrkCellCount != $count) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
foreach ($array2 as $i => $val) {
@@ -1274,7 +1274,7 @@ class MathTrig
$returnValue = 0;
// Loop through arguments
- foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
+ foreach (Functions::flattenArray(func_get_args()) as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
$returnValue += ($arg * $arg);
@@ -1294,8 +1294,8 @@ class MathTrig
*/
public static function SUMX2MY2($matrixData1, $matrixData2)
{
- $array1 = PHPExcel_Calculation_Functions::flattenArray($matrixData1);
- $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData2);
+ $array1 = Functions::flattenArray($matrixData1);
+ $array2 = Functions::flattenArray($matrixData2);
$count = min(count($array1), count($array2));
$result = 0;
@@ -1319,8 +1319,8 @@ class MathTrig
*/
public static function SUMX2PY2($matrixData1, $matrixData2)
{
- $array1 = PHPExcel_Calculation_Functions::flattenArray($matrixData1);
- $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData2);
+ $array1 = Functions::flattenArray($matrixData1);
+ $array2 = Functions::flattenArray($matrixData2);
$count = min(count($array1), count($array2));
$result = 0;
@@ -1344,8 +1344,8 @@ class MathTrig
*/
public static function SUMXMY2($matrixData1, $matrixData2)
{
- $array1 = PHPExcel_Calculation_Functions::flattenArray($matrixData1);
- $array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData2);
+ $array1 = Functions::flattenArray($matrixData1);
+ $array2 = Functions::flattenArray($matrixData2);
$count = min(count($array1), count($array2));
$result = 0;
@@ -1371,12 +1371,12 @@ class MathTrig
*/
public static function TRUNC($value = 0, $digits = 0)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $digits = PHPExcel_Calculation_Functions::flattenSingleValue($digits);
+ $value = Functions::flattenSingleValue($value);
+ $digits = Functions::flattenSingleValue($digits);
// Validate parameters
if ((!is_numeric($value)) || (!is_numeric($digits))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$digits = floor($digits);
diff --git a/classes/src/Calculation/Statistical.php b/classes/src/Calculation/Statistical.php
index 0c5b1e4b..d15ce3d8 100644
--- a/classes/src/Calculation/Statistical.php
+++ b/classes/src/Calculation/Statistical.php
@@ -53,8 +53,8 @@ class Statistical
$array2 = array($array2);
}
- $array1 = PHPExcel_Calculation_Functions::flattenArray($array1);
- $array2 = PHPExcel_Calculation_Functions::flattenArray($array2);
+ $array1 = Functions::flattenArray($array1);
+ $array2 = Functions::flattenArray($array2);
foreach ($array1 as $key => $value) {
if ((is_bool($value)) || (is_string($value)) || (is_null($value))) {
unset($array1[$key]);
@@ -551,7 +551,7 @@ class Statistical
(((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) * $q + 1);
}
// If 0 < p < 1, return a null value
- return PHPExcel_Calculation_Functions::NULL();
+ return Functions::NULL();
}
@@ -716,17 +716,17 @@ class Statistical
*/
public static function AVEDEV()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
// Return value
$returnValue = null;
$aMean = self::AVERAGE($aArgs);
- if ($aMean != PHPExcel_Calculation_Functions::DIV0()) {
+ if ($aMean != Functions::DIV0()) {
$aCount = 0;
foreach ($aArgs as $k => $arg) {
if ((is_bool($arg)) &&
- ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
+ ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) {
$arg = (integer) $arg;
}
// Is it a numeric value?
@@ -742,11 +742,11 @@ class Statistical
// Return
if ($aCount == 0) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
return $returnValue / $aCount;
}
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
@@ -768,9 +768,9 @@ class Statistical
$returnValue = $aCount = 0;
// Loop through arguments
- foreach (PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) {
+ foreach (Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) {
if ((is_bool($arg)) &&
- ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
+ ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) {
$arg = (integer) $arg;
}
// Is it a numeric value?
@@ -788,7 +788,7 @@ class Statistical
if ($aCount > 0) {
return $returnValue / $aCount;
} else {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
}
@@ -812,9 +812,9 @@ class Statistical
$aCount = 0;
// Loop through arguments
- foreach (PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) {
+ foreach (Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) {
if ((is_bool($arg)) &&
- (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
+ (!Functions::isMatrixValue($k))) {
} else {
if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) {
if (is_bool($arg)) {
@@ -835,7 +835,7 @@ class Statistical
if ($aCount > 0) {
return $returnValue / $aCount;
} else {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
}
@@ -859,12 +859,12 @@ class Statistical
{
$returnValue = 0;
- $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
- $averageArgs = PHPExcel_Calculation_Functions::flattenArray($averageArgs);
+ $aArgs = Functions::flattenArray($aArgs);
+ $averageArgs = Functions::flattenArray($averageArgs);
if (empty($averageArgs)) {
$averageArgs = $aArgs;
}
- $condition = PHPExcel_Calculation_Functions::ifCondition($condition);
+ $condition = Functions::ifCondition($condition);
// Loop through arguments
$aCount = 0;
foreach ($aArgs as $key => $arg) {
@@ -883,7 +883,7 @@ class Statistical
if ($aCount > 0) {
return $returnValue / $aCount;
}
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
@@ -901,15 +901,15 @@ class Statistical
*/
public static function BETADIST($value, $alpha, $beta, $rMin = 0, $rMax = 1)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
- $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta);
- $rMin = PHPExcel_Calculation_Functions::flattenSingleValue($rMin);
- $rMax = PHPExcel_Calculation_Functions::flattenSingleValue($rMax);
+ $value = Functions::flattenSingleValue($value);
+ $alpha = Functions::flattenSingleValue($alpha);
+ $beta = Functions::flattenSingleValue($beta);
+ $rMin = Functions::flattenSingleValue($rMin);
+ $rMax = Functions::flattenSingleValue($rMax);
if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) {
if (($value < $rMin) || ($value > $rMax) || ($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ($rMin > $rMax) {
$tmp = $rMin;
@@ -920,7 +920,7 @@ class Statistical
$value /= ($rMax - $rMin);
return self::incompleteBeta($value, $alpha, $beta);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -940,15 +940,15 @@ class Statistical
*/
public static function BETAINV($probability, $alpha, $beta, $rMin = 0, $rMax = 1)
{
- $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
- $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
- $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta);
- $rMin = PHPExcel_Calculation_Functions::flattenSingleValue($rMin);
- $rMax = PHPExcel_Calculation_Functions::flattenSingleValue($rMax);
+ $probability = Functions::flattenSingleValue($probability);
+ $alpha = Functions::flattenSingleValue($alpha);
+ $beta = Functions::flattenSingleValue($beta);
+ $rMin = Functions::flattenSingleValue($rMin);
+ $rMax = Functions::flattenSingleValue($rMax);
if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) {
if (($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax) || ($probability <= 0) || ($probability > 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ($rMin > $rMax) {
$tmp = $rMin;
@@ -971,11 +971,11 @@ class Statistical
}
}
if ($i == MAX_ITERATIONS) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
return round($rMin + $guess * ($rMax - $rMin), 12);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -999,30 +999,30 @@ class Statistical
*/
public static function BINOMDIST($value, $trials, $probability, $cumulative)
{
- $value = floor(PHPExcel_Calculation_Functions::flattenSingleValue($value));
- $trials = floor(PHPExcel_Calculation_Functions::flattenSingleValue($trials));
- $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
+ $value = floor(Functions::flattenSingleValue($value));
+ $trials = floor(Functions::flattenSingleValue($trials));
+ $probability = Functions::flattenSingleValue($probability);
if ((is_numeric($value)) && (is_numeric($trials)) && (is_numeric($probability))) {
if (($value < 0) || ($value > $trials)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if (($probability < 0) || ($probability > 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
if ($cumulative) {
$summer = 0;
for ($i = 0; $i <= $value; ++$i) {
- $summer += PHPExcel_Calculation_MathTrig::COMBIN($trials, $i) * pow($probability, $i) * pow(1 - $probability, $trials - $i);
+ $summer += MathTrig::COMBIN($trials, $i) * pow($probability, $i) * pow(1 - $probability, $trials - $i);
}
return $summer;
} else {
- return PHPExcel_Calculation_MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value) ;
+ return MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value) ;
}
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1037,22 +1037,22 @@ class Statistical
*/
public static function CHIDIST($value, $degrees)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees));
+ $value = Functions::flattenSingleValue($value);
+ $degrees = floor(Functions::flattenSingleValue($degrees));
if ((is_numeric($value)) && (is_numeric($degrees))) {
if ($degrees < 1) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ($value < 0) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
return 1;
}
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return 1 - (self::incompleteGamma($degrees/2, $value/2) / self::gamma($degrees/2));
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1067,8 +1067,8 @@ class Statistical
*/
public static function CHIINV($probability, $degrees)
{
- $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
- $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees));
+ $probability = Functions::flattenSingleValue($probability);
+ $degrees = floor(Functions::flattenSingleValue($degrees));
if ((is_numeric($probability)) && (is_numeric($degrees))) {
$xLo = 100;
@@ -1104,11 +1104,11 @@ class Statistical
$x = $xNew;
}
if ($i == MAX_ITERATIONS) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
return round($x, 12);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1125,20 +1125,20 @@ class Statistical
*/
public static function CONFIDENCE($alpha, $stdDev, $size)
{
- $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
- $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
- $size = floor(PHPExcel_Calculation_Functions::flattenSingleValue($size));
+ $alpha = Functions::flattenSingleValue($alpha);
+ $stdDev = Functions::flattenSingleValue($stdDev);
+ $size = floor(Functions::flattenSingleValue($size));
if ((is_numeric($alpha)) && (is_numeric($stdDev)) && (is_numeric($size))) {
if (($alpha <= 0) || ($alpha >= 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if (($stdDev <= 0) || ($size < 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return self::NORMSINV(1 - $alpha / 2) * $stdDev / sqrt($size);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1154,18 +1154,18 @@ class Statistical
public static function CORREL($yValues, $xValues = null)
{
if ((is_null($xValues)) || (!is_array($yValues)) || (!is_array($xValues))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (!self::checkTrendArrays($yValues, $xValues)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$yValueCount = count($yValues);
$xValueCount = count($xValues);
if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} elseif ($yValueCount == 1) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
@@ -1191,10 +1191,10 @@ class Statistical
$returnValue = 0;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
foreach ($aArgs as $k => $arg) {
if ((is_bool($arg)) &&
- ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
+ ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) {
$arg = (integer) $arg;
}
// Is it a numeric value?
@@ -1225,7 +1225,7 @@ class Statistical
$returnValue = 0;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
foreach ($aArgs as $arg) {
// Is it a numeric, boolean or string value?
if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) {
@@ -1255,7 +1255,7 @@ class Statistical
$returnValue = 0;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
foreach ($aArgs as $arg) {
// Is it a blank cell?
if ((is_null($arg)) || ((is_string($arg)) && ($arg == ''))) {
@@ -1285,8 +1285,8 @@ class Statistical
{
$returnValue = 0;
- $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
- $condition = PHPExcel_Calculation_Functions::ifCondition($condition);
+ $aArgs = Functions::flattenArray($aArgs);
+ $condition = Functions::ifCondition($condition);
// Loop through arguments
foreach ($aArgs as $arg) {
if (!is_numeric($arg)) {
@@ -1315,15 +1315,15 @@ class Statistical
public static function COVAR($yValues, $xValues)
{
if (!self::checkTrendArrays($yValues, $xValues)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$yValueCount = count($yValues);
$xValueCount = count($xValues);
if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} elseif ($yValueCount == 1) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
@@ -1352,17 +1352,17 @@ class Statistical
*/
public static function CRITBINOM($trials, $probability, $alpha)
{
- $trials = floor(PHPExcel_Calculation_Functions::flattenSingleValue($trials));
- $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
- $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
+ $trials = floor(Functions::flattenSingleValue($trials));
+ $probability = Functions::flattenSingleValue($probability);
+ $alpha = Functions::flattenSingleValue($alpha);
if ((is_numeric($trials)) && (is_numeric($probability)) && (is_numeric($alpha))) {
if ($trials < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif (($probability < 0) || ($probability > 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif (($alpha < 0) || ($alpha > 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif ($alpha <= 0.5) {
$t = sqrt(log(1 / ($alpha * $alpha)));
$trialsApprox = 0 - ($t + (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t));
@@ -1451,7 +1451,7 @@ class Statistical
}
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1470,19 +1470,19 @@ class Statistical
*/
public static function DEVSQ()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
// Return value
$returnValue = null;
$aMean = self::AVERAGE($aArgs);
- if ($aMean != PHPExcel_Calculation_Functions::DIV0()) {
+ if ($aMean != Functions::DIV0()) {
$aCount = -1;
foreach ($aArgs as $k => $arg) {
// Is it a numeric value?
if ((is_bool($arg)) &&
- ((!PHPExcel_Calculation_Functions::isCellValue($k)) ||
- (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
+ ((!Functions::isCellValue($k)) ||
+ (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) {
$arg = (integer) $arg;
}
if ((is_numeric($arg)) && (!is_string($arg))) {
@@ -1497,7 +1497,7 @@ class Statistical
// Return
if (is_null($returnValue)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} else {
return $returnValue;
}
@@ -1520,13 +1520,13 @@ class Statistical
*/
public static function EXPONDIST($value, $lambda, $cumulative)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $lambda = PHPExcel_Calculation_Functions::flattenSingleValue($lambda);
- $cumulative = PHPExcel_Calculation_Functions::flattenSingleValue($cumulative);
+ $value = Functions::flattenSingleValue($value);
+ $lambda = Functions::flattenSingleValue($lambda);
+ $cumulative = Functions::flattenSingleValue($cumulative);
if ((is_numeric($value)) && (is_numeric($lambda))) {
if (($value < 0) || ($lambda < 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
if ($cumulative) {
@@ -1536,7 +1536,7 @@ class Statistical
}
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1552,15 +1552,15 @@ class Statistical
*/
public static function FISHER($value)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
+ $value = Functions::flattenSingleValue($value);
if (is_numeric($value)) {
if (($value <= -1) || ($value >= 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return 0.5 * log((1+$value)/(1-$value));
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1576,12 +1576,12 @@ class Statistical
*/
public static function FISHERINV($value)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
+ $value = Functions::flattenSingleValue($value);
if (is_numeric($value)) {
return (exp(2 * $value) - 1) / (exp(2 * $value) + 1);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1597,19 +1597,19 @@ class Statistical
*/
public static function FORECAST($xValue, $yValues, $xValues)
{
- $xValue = PHPExcel_Calculation_Functions::flattenSingleValue($xValue);
+ $xValue = Functions::flattenSingleValue($xValue);
if (!is_numeric($xValue)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
} elseif (!self::checkTrendArrays($yValues, $xValues)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$yValueCount = count($yValues);
$xValueCount = count($xValues);
if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} elseif ($yValueCount == 1) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
@@ -1631,13 +1631,13 @@ class Statistical
*/
public static function GAMMADIST($value, $a, $b, $cumulative)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $a = PHPExcel_Calculation_Functions::flattenSingleValue($a);
- $b = PHPExcel_Calculation_Functions::flattenSingleValue($b);
+ $value = Functions::flattenSingleValue($value);
+ $a = Functions::flattenSingleValue($a);
+ $b = Functions::flattenSingleValue($b);
if ((is_numeric($value)) && (is_numeric($a)) && (is_numeric($b))) {
if (($value < 0) || ($a <= 0) || ($b <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
if ($cumulative) {
@@ -1647,7 +1647,7 @@ class Statistical
}
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1664,13 +1664,13 @@ class Statistical
*/
public static function GAMMAINV($probability, $alpha, $beta)
{
- $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
- $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
- $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta);
+ $probability = Functions::flattenSingleValue($probability);
+ $alpha = Functions::flattenSingleValue($alpha);
+ $beta = Functions::flattenSingleValue($beta);
if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta))) {
if (($alpha <= 0) || ($beta <= 0) || ($probability < 0) || ($probability > 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$xLo = 0;
@@ -1705,11 +1705,11 @@ class Statistical
$x = $xNew;
}
if ($i == MAX_ITERATIONS) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
return $x;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1723,15 +1723,15 @@ class Statistical
*/
public static function GAMMALN($value)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
+ $value = Functions::flattenSingleValue($value);
if (is_numeric($value)) {
if ($value <= 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return log(self::gamma($value));
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1752,16 +1752,16 @@ class Statistical
*/
public static function GEOMEAN()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
- $aMean = PHPExcel_Calculation_MathTrig::PRODUCT($aArgs);
+ $aMean = MathTrig::PRODUCT($aArgs);
if (is_numeric($aMean) && ($aMean > 0)) {
$aCount = self::COUNT($aArgs) ;
if (self::MIN($aArgs) > 0) {
return pow($aMean, (1 / $aCount));
}
}
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
@@ -1778,10 +1778,10 @@ class Statistical
*/
public static function GROWTH($yValues, $xValues = array(), $newValues = array(), $const = true)
{
- $yValues = PHPExcel_Calculation_Functions::flattenArray($yValues);
- $xValues = PHPExcel_Calculation_Functions::flattenArray($xValues);
- $newValues = PHPExcel_Calculation_Functions::flattenArray($newValues);
- $const = (is_null($const)) ? true : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
+ $yValues = Functions::flattenArray($yValues);
+ $xValues = Functions::flattenArray($xValues);
+ $newValues = Functions::flattenArray($newValues);
+ $const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const);
$bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL, $yValues, $xValues, $const);
if (empty($newValues)) {
@@ -1814,19 +1814,19 @@ class Statistical
public static function HARMEAN()
{
// Return value
- $returnValue = PHPExcel_Calculation_Functions::NA();
+ $returnValue = Functions::NA();
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
if (self::MIN($aArgs) < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$aCount = 0;
foreach ($aArgs as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
if ($arg <= 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if (is_null($returnValue)) {
$returnValue = (1 / $arg);
@@ -1861,26 +1861,26 @@ class Statistical
*/
public static function HYPGEOMDIST($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber)
{
- $sampleSuccesses = floor(PHPExcel_Calculation_Functions::flattenSingleValue($sampleSuccesses));
- $sampleNumber = floor(PHPExcel_Calculation_Functions::flattenSingleValue($sampleNumber));
- $populationSuccesses = floor(PHPExcel_Calculation_Functions::flattenSingleValue($populationSuccesses));
- $populationNumber = floor(PHPExcel_Calculation_Functions::flattenSingleValue($populationNumber));
+ $sampleSuccesses = floor(Functions::flattenSingleValue($sampleSuccesses));
+ $sampleNumber = floor(Functions::flattenSingleValue($sampleNumber));
+ $populationSuccesses = floor(Functions::flattenSingleValue($populationSuccesses));
+ $populationNumber = floor(Functions::flattenSingleValue($populationNumber));
if ((is_numeric($sampleSuccesses)) && (is_numeric($sampleNumber)) && (is_numeric($populationSuccesses)) && (is_numeric($populationNumber))) {
if (($sampleSuccesses < 0) || ($sampleSuccesses > $sampleNumber) || ($sampleSuccesses > $populationSuccesses)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if (($sampleNumber <= 0) || ($sampleNumber > $populationNumber)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if (($populationSuccesses <= 0) || ($populationSuccesses > $populationNumber)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- return PHPExcel_Calculation_MathTrig::COMBIN($populationSuccesses, $sampleSuccesses) *
- PHPExcel_Calculation_MathTrig::COMBIN($populationNumber - $populationSuccesses, $sampleNumber - $sampleSuccesses) /
- PHPExcel_Calculation_MathTrig::COMBIN($populationNumber, $sampleNumber);
+ return MathTrig::COMBIN($populationSuccesses, $sampleSuccesses) *
+ MathTrig::COMBIN($populationNumber - $populationSuccesses, $sampleNumber - $sampleSuccesses) /
+ MathTrig::COMBIN($populationNumber, $sampleNumber);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -1896,15 +1896,15 @@ class Statistical
public static function INTERCEPT($yValues, $xValues)
{
if (!self::checkTrendArrays($yValues, $xValues)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$yValueCount = count($yValues);
$xValueCount = count($xValues);
if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} elseif ($yValueCount == 1) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
@@ -1925,7 +1925,7 @@ class Statistical
*/
public static function KURT()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
$mean = self::AVERAGE($aArgs);
$stdDev = self::STDEV($aArgs);
@@ -1934,7 +1934,7 @@ class Statistical
// Loop through arguments
foreach ($aArgs as $k => $arg) {
if ((is_bool($arg)) &&
- (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
+ (!Functions::isMatrixValue($k))) {
} else {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
@@ -1949,7 +1949,7 @@ class Statistical
return $summer * ($count * ($count+1) / (($count-1) * ($count-2) * ($count-3))) - (3 * pow($count-1, 2) / (($count-2) * ($count-3)));
}
}
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
@@ -1971,7 +1971,7 @@ class Statistical
*/
public static function LARGE()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
// Calculate
$entry = floor(array_pop($aArgs));
@@ -1987,12 +1987,12 @@ class Statistical
$count = self::COUNT($mArgs);
$entry = floor(--$entry);
if (($entry < 0) || ($entry >= $count) || ($count == 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
rsort($mArgs);
return $mArgs[$entry];
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2010,21 +2010,21 @@ class Statistical
*/
public static function LINEST($yValues, $xValues = null, $const = true, $stats = false)
{
- $const = (is_null($const)) ? true : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
- $stats = (is_null($stats)) ? false : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats);
+ $const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const);
+ $stats = (is_null($stats)) ? false : (boolean) Functions::flattenSingleValue($stats);
if (is_null($xValues)) {
- $xValues = range(1, count(PHPExcel_Calculation_Functions::flattenArray($yValues)));
+ $xValues = range(1, count(Functions::flattenArray($yValues)));
}
if (!self::checkTrendArrays($yValues, $xValues)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$yValueCount = count($yValues);
$xValueCount = count($xValues);
if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} elseif ($yValueCount == 1) {
return 0;
}
@@ -2070,27 +2070,27 @@ class Statistical
*/
public static function LOGEST($yValues, $xValues = null, $const = true, $stats = false)
{
- $const = (is_null($const)) ? true : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
- $stats = (is_null($stats)) ? false : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats);
+ $const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const);
+ $stats = (is_null($stats)) ? false : (boolean) Functions::flattenSingleValue($stats);
if (is_null($xValues)) {
- $xValues = range(1, count(PHPExcel_Calculation_Functions::flattenArray($yValues)));
+ $xValues = range(1, count(Functions::flattenArray($yValues)));
}
if (!self::checkTrendArrays($yValues, $xValues)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$yValueCount = count($yValues);
$xValueCount = count($xValues);
foreach ($yValues as $value) {
if ($value <= 0.0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
}
if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} elseif ($yValueCount == 1) {
return 1;
}
@@ -2138,17 +2138,17 @@ class Statistical
*/
public static function LOGINV($probability, $mean, $stdDev)
{
- $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
- $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
- $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
+ $probability = Functions::flattenSingleValue($probability);
+ $mean = Functions::flattenSingleValue($mean);
+ $stdDev = Functions::flattenSingleValue($stdDev);
if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
if (($probability < 0) || ($probability > 1) || ($stdDev <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return exp($mean + $stdDev * self::NORMSINV($probability));
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2165,17 +2165,17 @@ class Statistical
*/
public static function LOGNORMDIST($value, $mean, $stdDev)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
- $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
+ $value = Functions::flattenSingleValue($value);
+ $mean = Functions::flattenSingleValue($mean);
+ $stdDev = Functions::flattenSingleValue($stdDev);
if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
if (($value <= 0) || ($stdDev <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return self::NORMSDIST((log($value) - $mean) / $stdDev);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2198,7 +2198,7 @@ class Statistical
$returnValue = null;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
foreach ($aArgs as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
@@ -2233,7 +2233,7 @@ class Statistical
$returnValue = null;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
foreach ($aArgs as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) {
@@ -2273,12 +2273,12 @@ class Statistical
{
$returnValue = null;
- $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
- $sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs);
+ $aArgs = Functions::flattenArray($aArgs);
+ $sumArgs = Functions::flattenArray($sumArgs);
if (empty($sumArgs)) {
$sumArgs = $aArgs;
}
- $condition = PHPExcel_Calculation_Functions::ifCondition($condition);
+ $condition = Functions::ifCondition($condition);
// Loop through arguments
foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) {
@@ -2310,11 +2310,11 @@ class Statistical
*/
public static function MEDIAN()
{
- $returnValue = PHPExcel_Calculation_Functions::NaN();
+ $returnValue = Functions::NaN();
$mArgs = array();
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
foreach ($aArgs as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
@@ -2357,7 +2357,7 @@ class Statistical
$returnValue = null;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
foreach ($aArgs as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
@@ -2392,7 +2392,7 @@ class Statistical
$returnValue = null;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
foreach ($aArgs as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) {
@@ -2432,12 +2432,12 @@ class Statistical
{
$returnValue = null;
- $aArgs = PHPExcel_Calculation_Functions::flattenArray($aArgs);
- $sumArgs = PHPExcel_Calculation_Functions::flattenArray($sumArgs);
+ $aArgs = Functions::flattenArray($aArgs);
+ $sumArgs = Functions::flattenArray($sumArgs);
if (empty($sumArgs)) {
$sumArgs = $aArgs;
}
- $condition = PHPExcel_Calculation_Functions::ifCondition($condition);
+ $condition = Functions::ifCondition($condition);
// Loop through arguments
foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) {
@@ -2486,7 +2486,7 @@ class Statistical
array_multisort($frequencyList, SORT_DESC, $valueList, SORT_ASC, SORT_NUMERIC, $frequencyArray);
if ($frequencyArray[0]['frequency'] == 1) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
return $frequencyArray[0]['value'];
}
@@ -2507,10 +2507,10 @@ class Statistical
*/
public static function MODE()
{
- $returnValue = PHPExcel_Calculation_Functions::NA();
+ $returnValue = Functions::NA();
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
$mArgs = array();
foreach ($aArgs as $arg) {
@@ -2545,24 +2545,24 @@ class Statistical
*/
public static function NEGBINOMDIST($failures, $successes, $probability)
{
- $failures = floor(PHPExcel_Calculation_Functions::flattenSingleValue($failures));
- $successes = floor(PHPExcel_Calculation_Functions::flattenSingleValue($successes));
- $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
+ $failures = floor(Functions::flattenSingleValue($failures));
+ $successes = floor(Functions::flattenSingleValue($successes));
+ $probability = Functions::flattenSingleValue($probability);
if ((is_numeric($failures)) && (is_numeric($successes)) && (is_numeric($probability))) {
if (($failures < 0) || ($successes < 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
} elseif (($probability < 0) || ($probability > 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
if (($failures + $successes - 1) <= 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
}
- return (PHPExcel_Calculation_MathTrig::COMBIN($failures + $successes - 1, $successes - 1)) * (pow($probability, $successes)) * (pow(1 - $probability, $failures));
+ return (MathTrig::COMBIN($failures + $successes - 1, $successes - 1)) * (pow($probability, $successes)) * (pow(1 - $probability, $failures));
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2582,23 +2582,23 @@ class Statistical
*/
public static function NORMDIST($value, $mean, $stdDev, $cumulative)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
- $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
+ $value = Functions::flattenSingleValue($value);
+ $mean = Functions::flattenSingleValue($mean);
+ $stdDev = Functions::flattenSingleValue($stdDev);
if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
if ($stdDev < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
if ($cumulative) {
- return 0.5 * (1 + PHPExcel_Calculation_Engineering::erfVal(($value - $mean) / ($stdDev * sqrt(2))));
+ return 0.5 * (1 + Engineering::erfVal(($value - $mean) / ($stdDev * sqrt(2))));
} else {
return (1 / (SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean, 2) / (2 * ($stdDev * $stdDev))));
}
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2615,20 +2615,20 @@ class Statistical
*/
public static function NORMINV($probability, $mean, $stdDev)
{
- $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
- $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
- $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
+ $probability = Functions::flattenSingleValue($probability);
+ $mean = Functions::flattenSingleValue($mean);
+ $stdDev = Functions::flattenSingleValue($stdDev);
if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
if (($probability < 0) || ($probability > 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ($stdDev < 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return (self::inverseNcdf($probability) * $stdDev) + $mean;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2644,7 +2644,7 @@ class Statistical
*/
public static function NORMSDIST($value)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
+ $value = Functions::flattenSingleValue($value);
return self::NORMDIST($value, 0, 1, true);
}
@@ -2680,14 +2680,14 @@ class Statistical
*/
public static function PERCENTILE()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
// Calculate
$entry = array_pop($aArgs);
if ((is_numeric($entry)) && (!is_string($entry))) {
if (($entry < 0) || ($entry > 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$mArgs = array();
foreach ($aArgs as $arg) {
@@ -2711,7 +2711,7 @@ class Statistical
}
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2727,9 +2727,9 @@ class Statistical
*/
public static function PERCENTRANK($valueSet, $value, $significance = 3)
{
- $valueSet = PHPExcel_Calculation_Functions::flattenArray($valueSet);
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $significance = (is_null($significance)) ? 3 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($significance);
+ $valueSet = Functions::flattenArray($valueSet);
+ $value = Functions::flattenSingleValue($value);
+ $significance = (is_null($significance)) ? 3 : (integer) Functions::flattenSingleValue($significance);
foreach ($valueSet as $key => $valueEntry) {
if (!is_numeric($valueEntry)) {
@@ -2739,12 +2739,12 @@ class Statistical
sort($valueSet, SORT_NUMERIC);
$valueCount = count($valueSet);
if ($valueCount == 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$valueAdjustor = $valueCount - 1;
if (($value < $valueSet[0]) || ($value > $valueSet[$valueAdjustor])) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
$pos = array_search($value, $valueSet);
@@ -2777,17 +2777,17 @@ class Statistical
*/
public static function PERMUT($numObjs, $numInSet)
{
- $numObjs = PHPExcel_Calculation_Functions::flattenSingleValue($numObjs);
- $numInSet = PHPExcel_Calculation_Functions::flattenSingleValue($numInSet);
+ $numObjs = Functions::flattenSingleValue($numObjs);
+ $numInSet = Functions::flattenSingleValue($numInSet);
if ((is_numeric($numObjs)) && (is_numeric($numInSet))) {
$numInSet = floor($numInSet);
if ($numObjs < $numInSet) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
- return round(PHPExcel_Calculation_MathTrig::FACT($numObjs) / PHPExcel_Calculation_MathTrig::FACT($numObjs - $numInSet));
+ return round(MathTrig::FACT($numObjs) / MathTrig::FACT($numObjs - $numInSet));
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2806,26 +2806,26 @@ class Statistical
*/
public static function POISSON($value, $mean, $cumulative)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
+ $value = Functions::flattenSingleValue($value);
+ $mean = Functions::flattenSingleValue($mean);
if ((is_numeric($value)) && (is_numeric($mean))) {
if (($value < 0) || ($mean <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
if ($cumulative) {
$summer = 0;
for ($i = 0; $i <= floor($value); ++$i) {
- $summer += pow($mean, $i) / PHPExcel_Calculation_MathTrig::FACT($i);
+ $summer += pow($mean, $i) / MathTrig::FACT($i);
}
return exp(0-$mean) * $summer;
} else {
- return (exp(0-$mean) * pow($mean, $value)) / PHPExcel_Calculation_MathTrig::FACT($value);
+ return (exp(0-$mean) * pow($mean, $value)) / MathTrig::FACT($value);
}
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2845,7 +2845,7 @@ class Statistical
*/
public static function QUARTILE()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
// Calculate
$entry = floor(array_pop($aArgs));
@@ -2853,11 +2853,11 @@ class Statistical
if ((is_numeric($entry)) && (!is_string($entry))) {
$entry /= 4;
if (($entry < 0) || ($entry > 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return self::PERCENTILE($aArgs, $entry);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -2873,9 +2873,9 @@ class Statistical
*/
public static function RANK($value, $valueSet, $order = 0)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $valueSet = PHPExcel_Calculation_Functions::flattenArray($valueSet);
- $order = (is_null($order)) ? 0 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($order);
+ $value = Functions::flattenSingleValue($value);
+ $valueSet = Functions::flattenArray($valueSet);
+ $order = (is_null($order)) ? 0 : (integer) Functions::flattenSingleValue($order);
foreach ($valueSet as $key => $valueEntry) {
if (!is_numeric($valueEntry)) {
@@ -2890,7 +2890,7 @@ class Statistical
}
$pos = array_search($value, $valueSet);
if ($pos === false) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
return ++$pos;
@@ -2909,15 +2909,15 @@ class Statistical
public static function RSQ($yValues, $xValues)
{
if (!self::checkTrendArrays($yValues, $xValues)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$yValueCount = count($yValues);
$xValueCount = count($xValues);
if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} elseif ($yValueCount == 1) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
@@ -2938,7 +2938,7 @@ class Statistical
*/
public static function SKEW()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
$mean = self::AVERAGE($aArgs);
$stdDev = self::STDEV($aArgs);
@@ -2946,7 +2946,7 @@ class Statistical
// Loop through arguments
foreach ($aArgs as $k => $arg) {
if ((is_bool($arg)) &&
- (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
+ (!Functions::isMatrixValue($k))) {
} else {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
@@ -2959,7 +2959,7 @@ class Statistical
if ($count > 2) {
return $summer * ($count / (($count-1) * ($count-2)));
}
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
@@ -2975,15 +2975,15 @@ class Statistical
public static function SLOPE($yValues, $xValues)
{
if (!self::checkTrendArrays($yValues, $xValues)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$yValueCount = count($yValues);
$xValueCount = count($xValues);
if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} elseif ($yValueCount == 1) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
@@ -3008,7 +3008,7 @@ class Statistical
*/
public static function SMALL()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
// Calculate
$entry = array_pop($aArgs);
@@ -3024,12 +3024,12 @@ class Statistical
$count = self::COUNT($mArgs);
$entry = floor(--$entry);
if (($entry < 0) || ($entry >= $count) || ($count == 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
sort($mArgs);
return $mArgs[$entry];
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -3045,17 +3045,17 @@ class Statistical
*/
public static function STANDARDIZE($value, $mean, $stdDev)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean);
- $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev);
+ $value = Functions::flattenSingleValue($value);
+ $mean = Functions::flattenSingleValue($mean);
+ $stdDev = Functions::flattenSingleValue($stdDev);
if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
if ($stdDev <= 0) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
return ($value - $mean) / $stdDev ;
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -3075,7 +3075,7 @@ class Statistical
*/
public static function STDEV()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
// Return value
$returnValue = null;
@@ -3085,7 +3085,7 @@ class Statistical
$aCount = -1;
foreach ($aArgs as $k => $arg) {
if ((is_bool($arg)) &&
- ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
+ ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) {
$arg = (integer) $arg;
}
// Is it a numeric value?
@@ -3104,7 +3104,7 @@ class Statistical
return sqrt($returnValue / $aCount);
}
}
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
@@ -3123,7 +3123,7 @@ class Statistical
*/
public static function STDEVA()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
$returnValue = null;
@@ -3132,7 +3132,7 @@ class Statistical
$aCount = -1;
foreach ($aArgs as $k => $arg) {
if ((is_bool($arg)) &&
- (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
+ (!Functions::isMatrixValue($k))) {
} else {
// Is it a numeric value?
if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) {
@@ -3155,7 +3155,7 @@ class Statistical
return sqrt($returnValue / $aCount);
}
}
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
@@ -3174,7 +3174,7 @@ class Statistical
*/
public static function STDEVP()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
$returnValue = null;
@@ -3183,7 +3183,7 @@ class Statistical
$aCount = 0;
foreach ($aArgs as $k => $arg) {
if ((is_bool($arg)) &&
- ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
+ ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) {
$arg = (integer) $arg;
}
// Is it a numeric value?
@@ -3201,7 +3201,7 @@ class Statistical
return sqrt($returnValue / $aCount);
}
}
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
@@ -3220,7 +3220,7 @@ class Statistical
*/
public static function STDEVPA()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
$returnValue = null;
@@ -3229,7 +3229,7 @@ class Statistical
$aCount = 0;
foreach ($aArgs as $k => $arg) {
if ((is_bool($arg)) &&
- (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
+ (!Functions::isMatrixValue($k))) {
} else {
// Is it a numeric value?
if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) {
@@ -3252,7 +3252,7 @@ class Statistical
return sqrt($returnValue / $aCount);
}
}
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
@@ -3268,15 +3268,15 @@ class Statistical
public static function STEYX($yValues, $xValues)
{
if (!self::checkTrendArrays($yValues, $xValues)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
$yValueCount = count($yValues);
$xValueCount = count($xValues);
if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
} elseif ($yValueCount == 1) {
- return PHPExcel_Calculation_Functions::DIV0();
+ return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
@@ -3296,13 +3296,13 @@ class Statistical
*/
public static function TDIST($value, $degrees, $tails)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees));
- $tails = floor(PHPExcel_Calculation_Functions::flattenSingleValue($tails));
+ $value = Functions::flattenSingleValue($value);
+ $degrees = floor(Functions::flattenSingleValue($degrees));
+ $tails = floor(Functions::flattenSingleValue($tails));
if ((is_numeric($value)) && (is_numeric($degrees)) && (is_numeric($tails))) {
if (($value < 0) || ($degrees < 1) || ($tails < 1) || ($tails > 2)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
// tdist, which finds the probability that corresponds to a given value
// of t with k degrees of freedom. This algorithm is translated from a
@@ -3344,7 +3344,7 @@ class Statistical
return 1 - abs((1 - $tValue) - $tValue);
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -3359,8 +3359,8 @@ class Statistical
*/
public static function TINV($probability, $degrees)
{
- $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability);
- $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees));
+ $probability = Functions::flattenSingleValue($probability);
+ $degrees = floor(Functions::flattenSingleValue($degrees));
if ((is_numeric($probability)) && (is_numeric($degrees))) {
$xLo = 100;
@@ -3396,11 +3396,11 @@ class Statistical
$x = $xNew;
}
if ($i == MAX_ITERATIONS) {
- return PHPExcel_Calculation_Functions::NA();
+ return Functions::NA();
}
return round($x, 12);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -3417,10 +3417,10 @@ class Statistical
*/
public static function TREND($yValues, $xValues = array(), $newValues = array(), $const = true)
{
- $yValues = PHPExcel_Calculation_Functions::flattenArray($yValues);
- $xValues = PHPExcel_Calculation_Functions::flattenArray($xValues);
- $newValues = PHPExcel_Calculation_Functions::flattenArray($newValues);
- $const = (is_null($const)) ? true : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const);
+ $yValues = Functions::flattenArray($yValues);
+ $xValues = Functions::flattenArray($xValues);
+ $newValues = Functions::flattenArray($newValues);
+ $const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const);
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues, $const);
if (empty($newValues)) {
@@ -3454,14 +3454,14 @@ class Statistical
*/
public static function TRIMMEAN()
{
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
// Calculate
$percent = array_pop($aArgs);
if ((is_numeric($percent)) && (!is_string($percent))) {
if (($percent < 0) || ($percent > 1)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$mArgs = array();
foreach ($aArgs as $arg) {
@@ -3478,7 +3478,7 @@ class Statistical
}
return self::AVERAGE($mArgs);
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -3497,12 +3497,12 @@ class Statistical
*/
public static function VARFunc()
{
- $returnValue = PHPExcel_Calculation_Functions::DIV0();
+ $returnValue = Functions::DIV0();
$summerA = $summerB = 0;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
$aCount = 0;
foreach ($aArgs as $arg) {
if (is_bool($arg)) {
@@ -3540,19 +3540,19 @@ class Statistical
*/
public static function VARA()
{
- $returnValue = PHPExcel_Calculation_Functions::DIV0();
+ $returnValue = Functions::DIV0();
$summerA = $summerB = 0;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
$aCount = 0;
foreach ($aArgs as $k => $arg) {
if ((is_string($arg)) &&
- (PHPExcel_Calculation_Functions::isValue($k))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ (Functions::isValue($k))) {
+ return Functions::VALUE();
} elseif ((is_string($arg)) &&
- (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
+ (!Functions::isMatrixValue($k))) {
} else {
// Is it a numeric value?
if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) {
@@ -3593,12 +3593,12 @@ class Statistical
public static function VARP()
{
// Return value
- $returnValue = PHPExcel_Calculation_Functions::DIV0();
+ $returnValue = Functions::DIV0();
$summerA = $summerB = 0;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
$aCount = 0;
foreach ($aArgs as $arg) {
if (is_bool($arg)) {
@@ -3636,19 +3636,19 @@ class Statistical
*/
public static function VARPA()
{
- $returnValue = PHPExcel_Calculation_Functions::DIV0();
+ $returnValue = Functions::DIV0();
$summerA = $summerB = 0;
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
+ $aArgs = Functions::flattenArrayIndexed(func_get_args());
$aCount = 0;
foreach ($aArgs as $k => $arg) {
if ((is_string($arg)) &&
- (PHPExcel_Calculation_Functions::isValue($k))) {
- return PHPExcel_Calculation_Functions::VALUE();
+ (Functions::isValue($k))) {
+ return Functions::VALUE();
} elseif ((is_string($arg)) &&
- (!PHPExcel_Calculation_Functions::isMatrixValue($k))) {
+ (!Functions::isMatrixValue($k))) {
} else {
// Is it a numeric value?
if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) {
@@ -3688,13 +3688,13 @@ class Statistical
*/
public static function WEIBULL($value, $alpha, $beta, $cumulative)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha);
- $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta);
+ $value = Functions::flattenSingleValue($value);
+ $alpha = Functions::flattenSingleValue($alpha);
+ $beta = Functions::flattenSingleValue($beta);
if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta))) {
if (($value < 0) || ($alpha <= 0) || ($beta <= 0)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
if ((is_numeric($cumulative)) || (is_bool($cumulative))) {
if ($cumulative) {
@@ -3704,7 +3704,7 @@ class Statistical
}
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -3723,9 +3723,9 @@ class Statistical
*/
public static function ZTEST($dataSet, $m0, $sigma = null)
{
- $dataSet = PHPExcel_Calculation_Functions::flattenArrayIndexed($dataSet);
- $m0 = PHPExcel_Calculation_Functions::flattenSingleValue($m0);
- $sigma = PHPExcel_Calculation_Functions::flattenSingleValue($sigma);
+ $dataSet = Functions::flattenArrayIndexed($dataSet);
+ $m0 = Functions::flattenSingleValue($m0);
+ $sigma = Functions::flattenSingleValue($sigma);
if (is_null($sigma)) {
$sigma = self::STDEV($dataSet);
diff --git a/classes/src/Calculation/TextData.php b/classes/src/Calculation/TextData.php
index 95cec18c..a4241550 100644
--- a/classes/src/Calculation/TextData.php
+++ b/classes/src/Calculation/TextData.php
@@ -47,7 +47,7 @@ class TextData
return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128);
} elseif (ord($c{0}) >= 254 && ord($c{0}) <= 255) {
// error
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
return 0;
}
@@ -60,10 +60,10 @@ class TextData
*/
public static function CHARACTER($character)
{
- $character = PHPExcel_Calculation_Functions::flattenSingleValue($character);
+ $character = Functions::flattenSingleValue($character);
if ((!is_numeric($character)) || ($character < 0)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (function_exists('mb_convert_encoding')) {
@@ -82,7 +82,7 @@ class TextData
*/
public static function TRIMNONPRINTABLE($stringValue = '')
{
- $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
+ $stringValue = Functions::flattenSingleValue($stringValue);
if (is_bool($stringValue)) {
return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
@@ -107,7 +107,7 @@ class TextData
*/
public static function TRIMSPACES($stringValue = '')
{
- $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
+ $stringValue = Functions::flattenSingleValue($stringValue);
if (is_bool($stringValue)) {
return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
}
@@ -128,11 +128,11 @@ class TextData
public static function ASCIICODE($characters)
{
if (($characters === null) || ($characters === '')) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
- $characters = PHPExcel_Calculation_Functions::flattenSingleValue($characters);
+ $characters = Functions::flattenSingleValue($characters);
if (is_bool($characters)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$characters = (int) $characters;
} else {
$characters = ($characters) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
@@ -164,10 +164,10 @@ class TextData
$returnValue = '';
// Loop through arguments
- $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
+ $aArgs = Functions::flattenArray(func_get_args());
foreach ($aArgs as $arg) {
if (is_bool($arg)) {
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
+ if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) {
$arg = (int) $arg;
} else {
$arg = ($arg) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
@@ -194,12 +194,12 @@ class TextData
*/
public static function DOLLAR($value = 0, $decimals = 2)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $decimals = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
+ $value = Functions::flattenSingleValue($value);
+ $decimals = is_null($decimals) ? 0 : Functions::flattenSingleValue($decimals);
// Validate parameters
if (!is_numeric($value) || !is_numeric($decimals)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$decimals = floor($decimals);
@@ -211,7 +211,7 @@ class TextData
if ($value < 0) {
$round = 0-$round;
}
- $value = PHPExcel_Calculation_MathTrig::MROUND($value, $round);
+ $value = MathTrig::MROUND($value, $round);
}
return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask);
@@ -229,9 +229,9 @@ class TextData
*/
public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1)
{
- $needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
- $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
- $offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
+ $needle = Functions::flattenSingleValue($needle);
+ $haystack = Functions::flattenSingleValue($haystack);
+ $offset = Functions::flattenSingleValue($offset);
if (!is_bool($needle)) {
if (is_bool($haystack)) {
@@ -252,7 +252,7 @@ class TextData
}
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -266,9 +266,9 @@ class TextData
*/
public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1)
{
- $needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
- $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
- $offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
+ $needle = Functions::flattenSingleValue($needle);
+ $haystack = Functions::flattenSingleValue($haystack);
+ $offset = Functions::flattenSingleValue($offset);
if (!is_bool($needle)) {
if (is_bool($haystack)) {
@@ -289,7 +289,7 @@ class TextData
}
}
}
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
@@ -303,13 +303,13 @@ class TextData
*/
public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $decimals = PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
- $no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas);
+ $value = Functions::flattenSingleValue($value);
+ $decimals = Functions::flattenSingleValue($decimals);
+ $no_commas = Functions::flattenSingleValue($no_commas);
// Validate parameters
if (!is_numeric($value) || !is_numeric($decimals)) {
- return PHPExcel_Calculation_Functions::NaN();
+ return Functions::NaN();
}
$decimals = floor($decimals);
@@ -334,11 +334,11 @@ class TextData
*/
public static function LEFT($value = '', $chars = 1)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
+ $value = Functions::flattenSingleValue($value);
+ $chars = Functions::flattenSingleValue($chars);
if ($chars < 0) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (is_bool($value)) {
@@ -363,12 +363,12 @@ class TextData
*/
public static function MID($value = '', $start = 1, $chars = null)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
- $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
+ $value = Functions::flattenSingleValue($value);
+ $start = Functions::flattenSingleValue($start);
+ $chars = Functions::flattenSingleValue($chars);
if (($start < 1) || ($chars < 0)) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (is_bool($value)) {
@@ -392,11 +392,11 @@ class TextData
*/
public static function RIGHT($value = '', $chars = 1)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
+ $value = Functions::flattenSingleValue($value);
+ $chars = Functions::flattenSingleValue($chars);
if ($chars < 0) {
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
if (is_bool($value)) {
@@ -419,7 +419,7 @@ class TextData
*/
public static function STRINGLENGTH($value = '')
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
+ $value = Functions::flattenSingleValue($value);
if (is_bool($value)) {
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
@@ -443,7 +443,7 @@ class TextData
*/
public static function LOWERCASE($mixedCaseString)
{
- $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
+ $mixedCaseString = Functions::flattenSingleValue($mixedCaseString);
if (is_bool($mixedCaseString)) {
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
@@ -463,7 +463,7 @@ class TextData
*/
public static function UPPERCASE($mixedCaseString)
{
- $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
+ $mixedCaseString = Functions::flattenSingleValue($mixedCaseString);
if (is_bool($mixedCaseString)) {
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
@@ -483,7 +483,7 @@ class TextData
*/
public static function PROPERCASE($mixedCaseString)
{
- $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
+ $mixedCaseString = Functions::flattenSingleValue($mixedCaseString);
if (is_bool($mixedCaseString)) {
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
@@ -504,10 +504,10 @@ class TextData
*/
public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText)
{
- $oldText = PHPExcel_Calculation_Functions::flattenSingleValue($oldText);
- $start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
- $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
- $newText = PHPExcel_Calculation_Functions::flattenSingleValue($newText);
+ $oldText = Functions::flattenSingleValue($oldText);
+ $start = Functions::flattenSingleValue($start);
+ $chars = Functions::flattenSingleValue($chars);
+ $newText = Functions::flattenSingleValue($newText);
$left = self::LEFT($oldText, $start-1);
$right = self::RIGHT($oldText, self::STRINGLENGTH($oldText)-($start+$chars)+1);
@@ -527,10 +527,10 @@ class TextData
*/
public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0)
{
- $text = PHPExcel_Calculation_Functions::flattenSingleValue($text);
- $fromText = PHPExcel_Calculation_Functions::flattenSingleValue($fromText);
- $toText = PHPExcel_Calculation_Functions::flattenSingleValue($toText);
- $instance = floor(PHPExcel_Calculation_Functions::flattenSingleValue($instance));
+ $text = Functions::flattenSingleValue($text);
+ $fromText = Functions::flattenSingleValue($fromText);
+ $toText = Functions::flattenSingleValue($toText);
+ $instance = floor(Functions::flattenSingleValue($instance));
if ($instance == 0) {
if (function_exists('mb_str_replace')) {
@@ -572,7 +572,7 @@ class TextData
*/
public static function RETURNSTRING($testValue = '')
{
- $testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
+ $testValue = Functions::flattenSingleValue($testValue);
if (is_string($testValue)) {
return $testValue;
@@ -590,11 +590,11 @@ class TextData
*/
public static function TEXTFORMAT($value, $format)
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
- $format = PHPExcel_Calculation_Functions::flattenSingleValue($format);
+ $value = Functions::flattenSingleValue($value);
+ $format = Functions::flattenSingleValue($format);
if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) {
- $value = PHPExcel_Calculation_DateTime::DATEVALUE($value);
+ $value = DateTime::DATEVALUE($value);
}
return (string) PHPExcel_Style_NumberFormat::toFormattedString($value, $format);
@@ -608,7 +608,7 @@ class TextData
*/
public static function VALUE($value = '')
{
- $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
+ $value = Functions::flattenSingleValue($value);
if (!is_numeric($value)) {
$numberValue = str_replace(
@@ -620,24 +620,24 @@ class TextData
return (float) $numberValue;
}
- $dateSetting = PHPExcel_Calculation_Functions::getReturnDateType();
- PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
+ $dateSetting = Functions::getReturnDateType();
+ Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
if (strpos($value, ':') !== false) {
- $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($value);
- if ($timeValue !== PHPExcel_Calculation_Functions::VALUE()) {
- PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
+ $timeValue = DateTime::TIMEVALUE($value);
+ if ($timeValue !== Functions::VALUE()) {
+ Functions::setReturnDateType($dateSetting);
return $timeValue;
}
}
- $dateValue = PHPExcel_Calculation_DateTime::DATEVALUE($value);
- if ($dateValue !== PHPExcel_Calculation_Functions::VALUE()) {
- PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
+ $dateValue = DateTime::DATEVALUE($value);
+ if ($dateValue !== Functions::VALUE()) {
+ Functions::setReturnDateType($dateSetting);
return $dateValue;
}
- PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
+ Functions::setReturnDateType($dateSetting);
- return PHPExcel_Calculation_Functions::VALUE();
+ return Functions::VALUE();
}
return (float) $value;
}
diff --git a/unitTests/Classes/PHPExcel/AutoloaderTest.php b/unitTests/Classes/PHPExcel/AutoloaderTest.php
deleted file mode 100644
index 842d1797..00000000
--- a/unitTests/Classes/PHPExcel/AutoloaderTest.php
+++ /dev/null
@@ -1,54 +0,0 @@
-assertTrue(is_bool($result));
- // ... indicating failure
- $this->assertFalse($result);
- }
-
- public function testAutoloaderInvalidPHPExcelClass()
- {
- $className = 'PHPExcel_Invalid_Class';
-
- $result = PHPExcel_Autoloader::Load($className);
- // Must return a boolean...
- $this->assertTrue(is_bool($result));
- // ... indicating failure
- $this->assertFalse($result);
- }
-
- public function testAutoloadValidPHPExcelClass()
- {
- $className = 'PHPExcel_IOFactory';
-
- $result = PHPExcel_Autoloader::Load($className);
- // Check that class has been loaded
- $this->assertTrue(class_exists($className));
- }
-
- public function testAutoloadInstantiateSuccess()
- {
- $result = new PHPExcel_Calculation_Function(1, 2, 3);
- // Must return an object...
- $this->assertTrue(is_object($result));
- // ... of the correct type
- $this->assertTrue(is_a($result, 'PHPExcel_Calculation_Function'));
- }
-}
diff --git a/unitTests/Classes/PHPExcel/Calculation/DateTimeTest.php b/unitTests/Classes/src/Calculation/DateTimeTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Calculation/DateTimeTest.php
rename to unitTests/Classes/src/Calculation/DateTimeTest.php
diff --git a/unitTests/Classes/PHPExcel/Calculation/EngineeringTest.php b/unitTests/Classes/src/Calculation/EngineeringTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Calculation/EngineeringTest.php
rename to unitTests/Classes/src/Calculation/EngineeringTest.php
diff --git a/unitTests/Classes/PHPExcel/Calculation/FinancialTest.php b/unitTests/Classes/src/Calculation/FinancialTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Calculation/FinancialTest.php
rename to unitTests/Classes/src/Calculation/FinancialTest.php
diff --git a/unitTests/Classes/PHPExcel/Calculation/FunctionsTest.php b/unitTests/Classes/src/Calculation/FunctionsTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Calculation/FunctionsTest.php
rename to unitTests/Classes/src/Calculation/FunctionsTest.php
diff --git a/unitTests/Classes/PHPExcel/Calculation/LogicalTest.php b/unitTests/Classes/src/Calculation/LogicalTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Calculation/LogicalTest.php
rename to unitTests/Classes/src/Calculation/LogicalTest.php
diff --git a/unitTests/Classes/PHPExcel/Calculation/LookupRefTest.php b/unitTests/Classes/src/Calculation/LookupRefTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Calculation/LookupRefTest.php
rename to unitTests/Classes/src/Calculation/LookupRefTest.php
diff --git a/unitTests/Classes/PHPExcel/Calculation/MathTrigTest.php b/unitTests/Classes/src/Calculation/MathTrigTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Calculation/MathTrigTest.php
rename to unitTests/Classes/src/Calculation/MathTrigTest.php
diff --git a/unitTests/Classes/PHPExcel/Calculation/TextDataTest.php b/unitTests/Classes/src/Calculation/TextDataTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Calculation/TextDataTest.php
rename to unitTests/Classes/src/Calculation/TextDataTest.php
diff --git a/unitTests/Classes/PHPExcel/CalculationTest.php b/unitTests/Classes/src/CalculationTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/CalculationTest.php
rename to unitTests/Classes/src/CalculationTest.php
diff --git a/unitTests/Classes/PHPExcel/Cell/AdvancedValueBinderTest.php b/unitTests/Classes/src/Cell/AdvancedValueBinderTest.php
similarity index 85%
rename from unitTests/Classes/PHPExcel/Cell/AdvancedValueBinderTest.php
rename to unitTests/Classes/src/Cell/AdvancedValueBinderTest.php
index 0a55ba73..22116411 100644
--- a/unitTests/Classes/PHPExcel/Cell/AdvancedValueBinderTest.php
+++ b/unitTests/Classes/src/Cell/AdvancedValueBinderTest.php
@@ -7,19 +7,19 @@ class AdvancedValueBinderTest extends PHPUnit_Framework_TestCase
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
- require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
+ require_once(PHPEXCEL_ROOT . '/Bootstrap.php');
}
public function provider()
{
- if (!class_exists('PHPExcel_Style_NumberFormat')) {
+ if (!class_exists('\\PHPExcel\\Style\\NumberFormat')) {
$this->setUp();
}
- $currencyUSD = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
- $currencyEURO = str_replace('$', '€', PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
+ $currencyUSD = \PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
+ $currencyEURO = str_replace('$', '€', \PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
return array(
- array('10%', 0.1, PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00, ',', '.', '$'),
+ array('10%', 0.1, \PHPExcel\Style\NumberFormat::FORMAT_PERCENTAGE_00, ',', '.', '$'),
array('$10.11', 10.11, $currencyUSD, ',', '.', '$'),
array('$1,010.12', 1010.12, $currencyUSD, ',', '.', '$'),
array('$20,20', 20.2, $currencyUSD, '.', ',', '$'),
diff --git a/unitTests/Classes/PHPExcel/Cell/DataTypeTest.php b/unitTests/Classes/src/Cell/DataTypeTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Cell/DataTypeTest.php
rename to unitTests/Classes/src/Cell/DataTypeTest.php
diff --git a/unitTests/Classes/PHPExcel/Cell/DefaultValueBinderTest.php b/unitTests/Classes/src/Cell/DefaultValueBinderTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Cell/DefaultValueBinderTest.php
rename to unitTests/Classes/src/Cell/DefaultValueBinderTest.php
diff --git a/unitTests/Classes/PHPExcel/Cell/HyperlinkTest.php b/unitTests/Classes/src/Cell/HyperlinkTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Cell/HyperlinkTest.php
rename to unitTests/Classes/src/Cell/HyperlinkTest.php
diff --git a/unitTests/Classes/PHPExcel/CellTest.php b/unitTests/Classes/src/CellTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/CellTest.php
rename to unitTests/Classes/src/CellTest.php
diff --git a/unitTests/Classes/PHPExcel/Chart/DataSeriesValuesTest.php b/unitTests/Classes/src/Chart/DataSeriesValuesTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Chart/DataSeriesValuesTest.php
rename to unitTests/Classes/src/Chart/DataSeriesValuesTest.php
diff --git a/unitTests/Classes/PHPExcel/Chart/LayoutTest.php b/unitTests/Classes/src/Chart/LayoutTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Chart/LayoutTest.php
rename to unitTests/Classes/src/Chart/LayoutTest.php
diff --git a/unitTests/Classes/PHPExcel/Chart/LegendTest.php b/unitTests/Classes/src/Chart/LegendTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Chart/LegendTest.php
rename to unitTests/Classes/src/Chart/LegendTest.php
diff --git a/unitTests/Classes/PHPExcel/Reader/XEEValidatorTest.php b/unitTests/Classes/src/Reader/XEEValidatorTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Reader/XEEValidatorTest.php
rename to unitTests/Classes/src/Reader/XEEValidatorTest.php
diff --git a/unitTests/Classes/PHPExcel/ReferenceHelperTest.php b/unitTests/Classes/src/ReferenceHelperTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/ReferenceHelperTest.php
rename to unitTests/Classes/src/ReferenceHelperTest.php
diff --git a/unitTests/Classes/PHPExcel/Shared/CodePageTest.php b/unitTests/Classes/src/Shared/CodePageTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Shared/CodePageTest.php
rename to unitTests/Classes/src/Shared/CodePageTest.php
diff --git a/unitTests/Classes/PHPExcel/Shared/DateTest.php b/unitTests/Classes/src/Shared/DateTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Shared/DateTest.php
rename to unitTests/Classes/src/Shared/DateTest.php
diff --git a/unitTests/Classes/PHPExcel/Shared/FileTest.php b/unitTests/Classes/src/Shared/FileTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Shared/FileTest.php
rename to unitTests/Classes/src/Shared/FileTest.php
diff --git a/unitTests/Classes/PHPExcel/Shared/FontTest.php b/unitTests/Classes/src/Shared/FontTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Shared/FontTest.php
rename to unitTests/Classes/src/Shared/FontTest.php
diff --git a/unitTests/Classes/PHPExcel/Shared/PasswordHasherTest.php b/unitTests/Classes/src/Shared/PasswordHasherTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Shared/PasswordHasherTest.php
rename to unitTests/Classes/src/Shared/PasswordHasherTest.php
diff --git a/unitTests/Classes/PHPExcel/Shared/StringTest.php b/unitTests/Classes/src/Shared/StringTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Shared/StringTest.php
rename to unitTests/Classes/src/Shared/StringTest.php
diff --git a/unitTests/Classes/PHPExcel/Shared/TimeZoneTest.php b/unitTests/Classes/src/Shared/TimeZoneTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Shared/TimeZoneTest.php
rename to unitTests/Classes/src/Shared/TimeZoneTest.php
diff --git a/unitTests/Classes/PHPExcel/Style/ColorTest.php b/unitTests/Classes/src/Style/ColorTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Style/ColorTest.php
rename to unitTests/Classes/src/Style/ColorTest.php
diff --git a/unitTests/Classes/PHPExcel/Style/NumberFormatTest.php b/unitTests/Classes/src/Style/NumberFormatTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Style/NumberFormatTest.php
rename to unitTests/Classes/src/Style/NumberFormatTest.php
diff --git a/unitTests/Classes/PHPExcel/Worksheet/AutoFilter/Column/RuleTest.php b/unitTests/Classes/src/Worksheet/AutoFilter/Column/RuleTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Worksheet/AutoFilter/Column/RuleTest.php
rename to unitTests/Classes/src/Worksheet/AutoFilter/Column/RuleTest.php
diff --git a/unitTests/Classes/PHPExcel/Worksheet/AutoFilter/ColumnTest.php b/unitTests/Classes/src/Worksheet/AutoFilter/ColumnTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Worksheet/AutoFilter/ColumnTest.php
rename to unitTests/Classes/src/Worksheet/AutoFilter/ColumnTest.php
diff --git a/unitTests/Classes/PHPExcel/Worksheet/AutoFilterTest.php b/unitTests/Classes/src/Worksheet/AutoFilterTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Worksheet/AutoFilterTest.php
rename to unitTests/Classes/src/Worksheet/AutoFilterTest.php
diff --git a/unitTests/Classes/PHPExcel/Worksheet/CellCollectionTest.php b/unitTests/Classes/src/Worksheet/CellCollectionTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Worksheet/CellCollectionTest.php
rename to unitTests/Classes/src/Worksheet/CellCollectionTest.php
diff --git a/unitTests/Classes/PHPExcel/Worksheet/ColumnCellIteratorTest.php b/unitTests/Classes/src/Worksheet/ColumnCellIteratorTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Worksheet/ColumnCellIteratorTest.php
rename to unitTests/Classes/src/Worksheet/ColumnCellIteratorTest.php
diff --git a/unitTests/Classes/PHPExcel/Worksheet/ColumnIteratorTest.php b/unitTests/Classes/src/Worksheet/ColumnIteratorTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Worksheet/ColumnIteratorTest.php
rename to unitTests/Classes/src/Worksheet/ColumnIteratorTest.php
diff --git a/unitTests/Classes/PHPExcel/Worksheet/RowCellIteratorTest.php b/unitTests/Classes/src/Worksheet/RowCellIteratorTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Worksheet/RowCellIteratorTest.php
rename to unitTests/Classes/src/Worksheet/RowCellIteratorTest.php
diff --git a/unitTests/Classes/PHPExcel/Worksheet/RowIteratorTest.php b/unitTests/Classes/src/Worksheet/RowIteratorTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Worksheet/RowIteratorTest.php
rename to unitTests/Classes/src/Worksheet/RowIteratorTest.php
diff --git a/unitTests/Classes/PHPExcel/Worksheet/WorksheetColumnTest.php b/unitTests/Classes/src/Worksheet/WorksheetColumnTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Worksheet/WorksheetColumnTest.php
rename to unitTests/Classes/src/Worksheet/WorksheetColumnTest.php
diff --git a/unitTests/Classes/PHPExcel/Worksheet/WorksheetRowTest.php b/unitTests/Classes/src/Worksheet/WorksheetRowTest.php
similarity index 100%
rename from unitTests/Classes/PHPExcel/Worksheet/WorksheetRowTest.php
rename to unitTests/Classes/src/Worksheet/WorksheetRowTest.php
diff --git a/unitTests/bootstrap.php b/unitTests/bootstrap.php
index d212d58a..7525ea9e 100644
--- a/unitTests/bootstrap.php
+++ b/unitTests/bootstrap.php
@@ -17,7 +17,7 @@ date_default_timezone_set('Europe/London');
// Define path to application directory
defined('APPLICATION_PATH')
- || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../Classes'));
+ || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../classes'));
// Define path to application tests directory
defined('APPLICATION_TESTS_PATH')
@@ -28,7 +28,7 @@ defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'ci');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
- realpath(APPLICATION_PATH . '/../Classes'),
+ realpath(APPLICATION_PATH . '/../classes'),
'./',
dirname(__FILE__),
get_include_path(),
diff --git a/unitTests/phpunit-cc.xml b/unitTests/phpunit-cc.xml
index 8cb6cf56..c6314ff5 100644
--- a/unitTests/phpunit-cc.xml
+++ b/unitTests/phpunit-cc.xml
@@ -17,15 +17,15 @@
- ./Classes
+ ./classes
- ../Classes
+ ../classes
- ../Classes/PHPExcel/Shared/PCLZip
- ../Classes/PHPExcel/Shared/JAMA
- ../Classes/PHPExcel/Writer/PDF
+ ../classes/src/Shared/PCLZip
+ ../classes/src/Shared/JAMA
+ ../classes/src/Writer/PDF
diff --git a/unitTests/phpunit.xml b/unitTests/phpunit.xml
index d024c28f..81c7c9de 100644
--- a/unitTests/phpunit.xml
+++ b/unitTests/phpunit.xml
@@ -17,15 +17,15 @@
- ./Classes
+ ./classes
- ../Classes
+ ../classes
- ../Classes/PHPExcel/Shared/PCLZip
- ../Classes/PHPExcel/Shared/JAMA
- ../Classes/PHPExcel/Writer/PDF
+ ../classes/src/Shared/PCLZip
+ ../classes/src/Shared/JAMA
+ ../classes/src/Writer/PDF