PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Calculation / Statistical / AggregateBase.php

AggregateBase.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Calculation/Statistical/AggregateBase.php

67 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\Statistical;
4
5 use TablePress\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 * @param mixed $arg
14 * @param mixed $k
15 * @return mixed
16 */
17 protected static function testAcceptedBoolean($arg, $k)
18 {
19 if (!is_bool($arg)) {
20 return $arg;
21 }
22 if (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_GNUMERIC) {
23 return $arg;
24 }
25 if (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_OPENOFFICE) {
26 return (int) $arg;
27 }
28 if (!Functions::isCellValue($k)) {
29 return (int) $arg;
30 }
31 /*if (
32 (is_bool($arg)) &&
33 ((!Functions::isCellValue($k) && (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_EXCEL)) ||
34 (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_OPENOFFICE))
35 ) {
36 $arg = (int) $arg;
37 }*/
38
39 return $arg;
40 }
41
42 /**
43 * @param mixed $arg
44 * @param mixed $k
45 */
46 protected static function isAcceptedCountable($arg, $k, bool $countNull = false): bool
47 {
48 if ($countNull && $arg === null && !Functions::isCellValue($k) && Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_GNUMERIC) {
49 return true;
50 }
51 if (!is_numeric($arg)) {
52 return false;
53 }
54 if (!is_string($arg)) {
55 return true;
56 }
57 if (!Functions::isCellValue($k) && Functions::getCompatibilityMode() === Functions::COMPATIBILITY_OPENOFFICE) {
58 return true;
59 }
60 if (!Functions::isCellValue($k) && Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_GNUMERIC) {
61 return true;
62 }
63
64 return false;
65 }
66 }
67