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 401 and 402] [Versions 401 and 403]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical;
   4  
   5  use PhpOffice\PhpSpreadsheet\Calculation\Functions;
   6  
   7  abstract class AggregateBase
   8  {
   9      /**
  10       * MS Excel does not count Booleans if passed as cell values, but they are counted if passed as literals.
  11       * OpenOffice Calc always counts Booleans.
  12       * Gnumeric never counts Booleans.
  13       *
  14       * @param mixed $arg
  15       * @param mixed $k
  16       *
  17       * @return int|mixed
  18       */
  19      protected static function testAcceptedBoolean($arg, $k)
  20      {
  21          if (
  22              (is_bool($arg)) &&
  23              ((!Functions::isCellValue($k) && (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_EXCEL)) ||
  24                  (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_OPENOFFICE))
  25          ) {
  26              $arg = (int) $arg;
  27          }
  28  
  29          return $arg;
  30      }
  31  
  32      /**
  33       * @param mixed $arg
  34       * @param mixed $k
  35       *
  36       * @return bool
  37       */
  38      protected static function isAcceptedCountable($arg, $k)
  39      {
  40          if (
  41              ((is_numeric($arg)) && (!is_string($arg))) ||
  42              ((is_numeric($arg)) && (!Functions::isCellValue($k)) &&
  43                  (Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_GNUMERIC))
  44          ) {
  45              return true;
  46          }
  47  
  48          return false;
  49      }
  50  }