Fix code style
This commit is contained in:
parent
77b3c12fbc
commit
097d349e9c
|
@ -1127,16 +1127,20 @@ class MathTrig
|
||||||
return Functions::VALUE();
|
return Functions::VALUE();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function filterHiddenArgs($cellReference, $args) {
|
protected static function filterHiddenArgs($cellReference, $args)
|
||||||
return array_filter($args,
|
{
|
||||||
|
return array_filter(
|
||||||
|
$args,
|
||||||
function ($index) use ($cellReference) {
|
function ($index) use ($cellReference) {
|
||||||
list(, $row, $column) = explode('.', $index);
|
list(, $row, $column) = explode('.', $index);
|
||||||
|
|
||||||
return $cellReference->getWorksheet()->getRowDimension($row)->getVisible() &&
|
return $cellReference->getWorksheet()->getRowDimension($row)->getVisible() &&
|
||||||
$cellReference->getWorksheet()->getColumnDimension($column)->getVisible();
|
$cellReference->getWorksheet()->getColumnDimension($column)->getVisible();
|
||||||
},
|
},
|
||||||
ARRAY_FILTER_USE_KEY
|
ARRAY_FILTER_USE_KEY
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SUBTOTAL.
|
* SUBTOTAL.
|
||||||
*
|
*
|
||||||
|
@ -1153,53 +1157,35 @@ class MathTrig
|
||||||
$aArgs = Functions::flattenArrayIndexed($args);
|
$aArgs = Functions::flattenArrayIndexed($args);
|
||||||
$cellReference = array_pop($aArgs);
|
$cellReference = array_pop($aArgs);
|
||||||
$subtotal = array_shift($aArgs);
|
$subtotal = array_shift($aArgs);
|
||||||
// var_dump($cellReference->getValue(), $aArgs); die();
|
|
||||||
|
|
||||||
// Calculate
|
// Calculate
|
||||||
if ((is_numeric($subtotal)) && (!is_string($subtotal))) {
|
if ((is_numeric($subtotal)) && (!is_string($subtotal))) {
|
||||||
|
if ($subtotal > 100) {
|
||||||
|
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
||||||
|
$subtotal = $subtotal - 100;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($subtotal) {
|
switch ($subtotal) {
|
||||||
case 101:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 1:
|
case 1:
|
||||||
return Statistical::AVERAGE($aArgs);
|
return Statistical::AVERAGE($aArgs);
|
||||||
case 102:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 2:
|
case 2:
|
||||||
return Statistical::COUNT($aArgs);
|
return Statistical::COUNT($aArgs);
|
||||||
case 103:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 3:
|
case 3:
|
||||||
return Statistical::COUNTA($aArgs);
|
return Statistical::COUNTA($aArgs);
|
||||||
case 104:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 4:
|
case 4:
|
||||||
return Statistical::MAX($aArgs);
|
return Statistical::MAX($aArgs);
|
||||||
case 105:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 5:
|
case 5:
|
||||||
return Statistical::MIN($aArgs);
|
return Statistical::MIN($aArgs);
|
||||||
case 106:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 6:
|
case 6:
|
||||||
return self::PRODUCT($aArgs);
|
return self::PRODUCT($aArgs);
|
||||||
case 107:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 7:
|
case 7:
|
||||||
return Statistical::STDEV($aArgs);
|
return Statistical::STDEV($aArgs);
|
||||||
case 108:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 8:
|
case 8:
|
||||||
return Statistical::STDEVP($aArgs);
|
return Statistical::STDEVP($aArgs);
|
||||||
case 109:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 9:
|
case 9:
|
||||||
return self::SUM($aArgs);
|
return self::SUM($aArgs);
|
||||||
case 110:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 10:
|
case 10:
|
||||||
return Statistical::VARFunc($aArgs);
|
return Statistical::VARFunc($aArgs);
|
||||||
case 111:
|
|
||||||
$aArgs = self::filterHiddenArgs($cellReference, $aArgs);
|
|
||||||
case 11:
|
case 11:
|
||||||
return Statistical::VARP($aArgs);
|
return Statistical::VARP($aArgs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -862,7 +862,7 @@ class Cell
|
||||||
*/
|
*/
|
||||||
public static function stringFromColumnIndex($columnIndex)
|
public static function stringFromColumnIndex($columnIndex)
|
||||||
{
|
{
|
||||||
static $indexCache = array();
|
static $indexCache = [];
|
||||||
|
|
||||||
if (!isset($indexCache[$columnIndex])) {
|
if (!isset($indexCache[$columnIndex])) {
|
||||||
$indexValue = $columnIndex + 1;
|
$indexValue = $columnIndex + 1;
|
||||||
|
@ -870,10 +870,11 @@ class Cell
|
||||||
do {
|
do {
|
||||||
$characterValue = ($indexValue % 26) ?: 26;
|
$characterValue = ($indexValue % 26) ?: 26;
|
||||||
$indexValue = ($indexValue - $characterValue) / 26;
|
$indexValue = ($indexValue - $characterValue) / 26;
|
||||||
$base26 = chr($characterValue + 64).($base26 ?: '');
|
$base26 = chr($characterValue + 64) . ($base26 ?: '');
|
||||||
} while ($indexValue > 0);
|
} while ($indexValue > 0);
|
||||||
$indexCache[$columnIndex] = $base26;
|
$indexCache[$columnIndex] = $base26;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $indexCache[$columnIndex];
|
return $indexCache[$columnIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue