CashFlowValidations.php
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?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\Functions;
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(Functions::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);
}
}