Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering;
   4  
   5  use PhpOffice\PhpSpreadsheet\Calculation\Exception;
   6  use PhpOffice\PhpSpreadsheet\Calculation\Functions;
   7  
   8  class EngineeringValidations
   9  {
  10      /**
  11       * @param mixed $value
  12       */
  13      public static function validateFloat($value): float
  14      {
  15          if (!is_numeric($value)) {
  16              throw new Exception(Functions::VALUE());
  17          }
  18  
  19          return (float) $value;
  20      }
  21  
  22      /**
  23       * @param mixed $value
  24       */
  25      public static function validateInt($value): int
  26      {
  27          if (!is_numeric($value)) {
  28              throw new Exception(Functions::VALUE());
  29          }
  30  
  31          return (int) floor((float) $value);
  32      }
  33  }