ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
CashFlowValidations.php
Go to the documentation of this file.
1<?php
2
4
9
11{
15 public static function validateRate($rate): float
16 {
17 $rate = self::validateFloat($rate);
18 if ($rate < 0.0) {
19 throw new Exception(Functions::NAN());
20 }
21
22 return $rate;
23 }
24
28 public static function validatePeriodType($type): int
29 {
30 $rate = self::validateInt($type);
31 if (
32 $type !== FinancialConstants::PAYMENT_END_OF_PERIOD &&
33 $type !== FinancialConstants::PAYMENT_BEGINNING_OF_PERIOD
34 ) {
35 throw new Exception(Functions::NAN());
36 }
37
38 return $rate;
39 }
40
44 public static function validatePresentValue($presentValue): float
45 {
46 return self::validateFloat($presentValue);
47 }
48
52 public static function validateFutureValue($futureValue): float
53 {
54 return self::validateFloat($futureValue);
55 }
56}
An exception for terminatinating execution or to throw for unit testing.
$type