Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow;
   4  
   5  use PhpOffice\PhpSpreadsheet\Calculation\Exception;
   6  use PhpOffice\PhpSpreadsheet\Calculation\Financial\Constants as FinancialConstants;
   7  use PhpOffice\PhpSpreadsheet\Calculation\Financial\FinancialValidations;
   8  use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
   9  
  10  class CashFlowValidations extends FinancialValidations
  11  {
  12      /**
  13       * @param mixed $rate
  14       */
  15      public static function validateRate($rate): float
  16      {
  17          $rate = self::validateFloat($rate);
  18  
  19          return $rate;
  20      }
  21  
  22      /**
  23       * @param mixed $type
  24       */
  25      public static function validatePeriodType($type): int
  26      {
  27          $rate = self::validateInt($type);
  28          if (
  29              $type !== FinancialConstants::PAYMENT_END_OF_PERIOD &&
  30              $type !== FinancialConstants::PAYMENT_BEGINNING_OF_PERIOD
  31          ) {
  32              throw new Exception(ExcelError::NAN());
  33          }
  34  
  35          return $rate;
  36      }
  37  
  38      /**
  39       * @param mixed $presentValue
  40       */
  41      public static function validatePresentValue($presentValue): float
  42      {
  43          return self::validateFloat($presentValue);
  44      }
  45  
  46      /**
  47       * @param mixed $futureValue
  48       */
  49      public static function validateFutureValue($futureValue): float
  50      {
  51          return self::validateFloat($futureValue);
  52      }
  53  }