mirror of
https://github.com/Karaka-Management/Resources.git
synced 2026-01-21 17:18:40 +00:00
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants;
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Financial\FinancialValidations;
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
|
|
|
|
class CashFlowValidations extends FinancialValidations
|
|
{
|
|
/**
|
|
* @param mixed $rate
|
|
*/
|
|
public static function validateRate($rate): float
|
|
{
|
|
$rate = self::validateFloat($rate);
|
|
|
|
return $rate;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $type
|
|
*/
|
|
public static function validatePeriodType($type): int
|
|
{
|
|
$rate = self::validateInt($type);
|
|
if (
|
|
$type !== FinancialConstants::PAYMENT_END_OF_PERIOD &&
|
|
$type !== FinancialConstants::PAYMENT_BEGINNING_OF_PERIOD
|
|
) {
|
|
throw new Exception(ExcelError::NAN());
|
|
}
|
|
|
|
return $rate;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $presentValue
|
|
*/
|
|
public static function validatePresentValue($presentValue): float
|
|
{
|
|
return self::validateFloat($presentValue);
|
|
}
|
|
|
|
/**
|
|
* @param mixed $futureValue
|
|
*/
|
|
public static function validateFutureValue($futureValue): float
|
|
{
|
|
return self::validateFloat($futureValue);
|
|
}
|
|
}
|