tablepress
/
libraries
/
vendor
/
PhpSpreadsheet
/
Calculation
/
Financial
/
Securities
/
SecurityValidations.php
SecurityValidations.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Calculation/Financial/Securities/SecurityValidations.php
| 1 | <?php |
| 2 | |
| 3 | namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities; |
| 4 | |
| 5 | use TablePress\PhpOffice\PhpSpreadsheet\Calculation\Exception; |
| 6 | use TablePress\PhpOffice\PhpSpreadsheet\Calculation\Financial\FinancialValidations; |
| 7 | use TablePress\PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; |
| 8 | |
| 9 | class SecurityValidations extends FinancialValidations |
| 10 | { |
| 11 | /** |
| 12 | * @param mixed $issue |
| 13 | */ |
| 14 | public static function validateIssueDate($issue): float |
| 15 | { |
| 16 | return self::validateDate($issue); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * @param mixed $settlement |
| 21 | * @param mixed $maturity |
| 22 | */ |
| 23 | public static function validateSecurityPeriod($settlement, $maturity): void |
| 24 | { |
| 25 | if ($settlement >= $maturity) { |
| 26 | throw new Exception(ExcelError::NAN()); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * @param mixed $redemption |
| 32 | */ |
| 33 | public static function validateRedemption($redemption): float |
| 34 | { |
| 35 | $redemption = self::validateFloat($redemption); |
| 36 | if ($redemption <= 0.0) { |
| 37 | throw new Exception(ExcelError::NAN()); |
| 38 | } |
| 39 | |
| 40 | return $redemption; |
| 41 | } |
| 42 | } |
| 43 |