Add declaration of undefined variable
This commit is contained in:
parent
58268fe9b5
commit
6088f545b6
|
@ -2782,7 +2782,7 @@ class Calculation
|
|||
*
|
||||
* @param string $formula Formula to parse
|
||||
*
|
||||
* @return array
|
||||
* @return array|bool
|
||||
*/
|
||||
public function parseFormula($formula)
|
||||
{
|
||||
|
@ -4278,6 +4278,8 @@ class Calculation
|
|||
throw new Exception($errorMessage);
|
||||
}
|
||||
trigger_error($errorMessage, E_USER_ERROR);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4305,6 +4307,8 @@ class Calculation
|
|||
$aReferences = Coordinate::extractAllCellReferencesInRange($pRange);
|
||||
$pRange = $pSheetName . '!' . $pRange;
|
||||
if (!isset($aReferences[1])) {
|
||||
$currentCol = '';
|
||||
$currentRow = 0;
|
||||
// Single cell in range
|
||||
sscanf($aReferences[0], '%[A-Z]%d', $currentCol, $currentRow);
|
||||
if ($pSheet->cellExists($aReferences[0])) {
|
||||
|
@ -4315,6 +4319,8 @@ class Calculation
|
|||
} else {
|
||||
// Extract cell data for all cells in the range
|
||||
foreach ($aReferences as $reference) {
|
||||
$currentCol = '';
|
||||
$currentRow = 0;
|
||||
// Extract range
|
||||
sscanf($reference, '%[A-Z]%d', $currentCol, $currentRow);
|
||||
if ($pSheet->cellExists($reference)) {
|
||||
|
|
|
@ -339,6 +339,9 @@ abstract class Coordinate
|
|||
// Sort the result by column and row
|
||||
$sortKeys = [];
|
||||
foreach (array_unique($returnValue) as $coord) {
|
||||
$column = '';
|
||||
$row = 0;
|
||||
|
||||
sscanf($coord, '%[A-Z]%d', $column, $row);
|
||||
$sortKeys[sprintf('%3s%09d', $column, $row)] = $coord;
|
||||
}
|
||||
|
|
|
@ -134,6 +134,7 @@ class JpGraph implements IRenderer
|
|||
|
||||
private function percentageSumCalculation($groupID, $seriesCount)
|
||||
{
|
||||
$sumValues = [];
|
||||
// Adjust our values to a percentage value across all series in the group
|
||||
for ($i = 0; $i < $seriesCount; ++$i) {
|
||||
if ($i == 0) {
|
||||
|
@ -614,8 +615,9 @@ class JpGraph implements IRenderer
|
|||
for ($groupID = 0; $groupID < $iLimit; ++$groupID) {
|
||||
$grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
|
||||
$exploded = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
|
||||
$datasetLabels = [];
|
||||
if ($groupID == 0) {
|
||||
$labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
|
||||
$labelCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount();
|
||||
if ($labelCount > 0) {
|
||||
$datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
|
||||
$datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
|
||||
|
|
|
@ -153,6 +153,8 @@ class Cells
|
|||
{
|
||||
$sortKeys = [];
|
||||
foreach ($this->getCoordinates() as $coord) {
|
||||
$column = '';
|
||||
$row = 0;
|
||||
sscanf($coord, '%[A-Z]%d', $column, $row);
|
||||
$sortKeys[sprintf('%09d%3s', $row, $column)] = $coord;
|
||||
}
|
||||
|
@ -172,15 +174,16 @@ class Cells
|
|||
$col = ['A' => '1A'];
|
||||
$row = [1];
|
||||
foreach ($this->getCoordinates() as $coord) {
|
||||
$c = '';
|
||||
$r = 0;
|
||||
sscanf($coord, '%[A-Z]%d', $c, $r);
|
||||
$row[$r] = $r;
|
||||
$col[$c] = strlen($c) . $c;
|
||||
}
|
||||
if (!empty($row)) {
|
||||
|
||||
// Determine highest column and row
|
||||
$highestRow = max($row);
|
||||
$highestColumn = substr(max($col), 1);
|
||||
}
|
||||
|
||||
return [
|
||||
'row' => $highestRow,
|
||||
|
@ -205,6 +208,9 @@ class Cells
|
|||
*/
|
||||
public function getCurrentColumn()
|
||||
{
|
||||
$column = '';
|
||||
$row = 0;
|
||||
|
||||
sscanf($this->currentCoordinate, '%[A-Z]%d', $column, $row);
|
||||
|
||||
return $column;
|
||||
|
@ -217,6 +223,9 @@ class Cells
|
|||
*/
|
||||
public function getCurrentRow()
|
||||
{
|
||||
$column = '';
|
||||
$row = 0;
|
||||
|
||||
sscanf($this->currentCoordinate, '%[A-Z]%d', $column, $row);
|
||||
|
||||
return (int) $row;
|
||||
|
@ -240,6 +249,9 @@ class Cells
|
|||
|
||||
$columnList = [1];
|
||||
foreach ($this->getCoordinates() as $coord) {
|
||||
$c = '';
|
||||
$r = 0;
|
||||
|
||||
sscanf($coord, '%[A-Z]%d', $c, $r);
|
||||
if ($r != $row) {
|
||||
continue;
|
||||
|
@ -268,6 +280,9 @@ class Cells
|
|||
|
||||
$rowList = [0];
|
||||
foreach ($this->getCoordinates() as $coord) {
|
||||
$c = '';
|
||||
$r = 0;
|
||||
|
||||
sscanf($coord, '%[A-Z]%d', $c, $r);
|
||||
if ($c != $column) {
|
||||
continue;
|
||||
|
@ -336,6 +351,9 @@ class Cells
|
|||
public function removeRow($row)
|
||||
{
|
||||
foreach ($this->getCoordinates() as $coord) {
|
||||
$c = '';
|
||||
$r = 0;
|
||||
|
||||
sscanf($coord, '%[A-Z]%d', $c, $r);
|
||||
if ($r == $row) {
|
||||
$this->delete($coord);
|
||||
|
@ -351,6 +369,9 @@ class Cells
|
|||
public function removeColumn($column)
|
||||
{
|
||||
foreach ($this->getCoordinates() as $coord) {
|
||||
$c = '';
|
||||
$r = 0;
|
||||
|
||||
sscanf($coord, '%[A-Z]%d', $c, $r);
|
||||
if ($c == $column) {
|
||||
$this->delete($coord);
|
||||
|
|
|
@ -278,6 +278,7 @@ class Chart
|
|||
break;
|
||||
case 'ser':
|
||||
$marker = null;
|
||||
$seriesIndex = '';
|
||||
foreach ($seriesDetails as $seriesKey => $seriesDetail) {
|
||||
switch ($seriesKey) {
|
||||
case 'idx':
|
||||
|
@ -433,7 +434,7 @@ class Chart
|
|||
private static function parseRichText(SimpleXMLElement $titleDetailPart)
|
||||
{
|
||||
$value = new RichText();
|
||||
|
||||
$objText = null;
|
||||
foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
|
||||
if (isset($titleDetailElement->t)) {
|
||||
$objText = $value->createTextRun((string) $titleDetailElement->t);
|
||||
|
|
|
@ -82,6 +82,9 @@ class ReferenceHelper
|
|||
*/
|
||||
public static function cellSort($a, $b)
|
||||
{
|
||||
$ac = $bc = '';
|
||||
$ar = $br = 0;
|
||||
|
||||
sscanf($a, '%[A-Z]%d', $ac, $ar);
|
||||
sscanf($b, '%[A-Z]%d', $bc, $br);
|
||||
|
||||
|
@ -103,6 +106,9 @@ class ReferenceHelper
|
|||
*/
|
||||
public static function cellReverseSort($a, $b)
|
||||
{
|
||||
$ac = $bc = '';
|
||||
$ar = $br = 0;
|
||||
|
||||
sscanf($a, '%[A-Z]%d', $ac, $ar);
|
||||
sscanf($b, '%[A-Z]%d', $bc, $br);
|
||||
|
||||
|
@ -529,6 +535,8 @@ class ReferenceHelper
|
|||
if ($pNumCols != 0) {
|
||||
$autoFilterColumns = $autoFilter->getColumns();
|
||||
if (count($autoFilterColumns) > 0) {
|
||||
$column = '';
|
||||
$row = 0;
|
||||
sscanf($pBefore, '%[A-Z]%d', $column, $row);
|
||||
$columnIndex = Coordinate::columnIndexFromString($column);
|
||||
list($rangeStart, $rangeEnd) = Coordinate::rangeBoundaries($autoFilterRange);
|
||||
|
|
|
@ -234,7 +234,7 @@ class Matrix
|
|||
$R = new self($m, $n);
|
||||
for ($i = 0; $i < $m; ++$i) {
|
||||
for ($j = 0; $j < $n; ++$j) {
|
||||
$R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]);
|
||||
$R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ class Matrix
|
|||
$R = new self($m, $n);
|
||||
for ($i = $i0; $i < $iF; ++$i) {
|
||||
for ($j = 0; $j < $n; ++$j) {
|
||||
$R->set($i - $i0, $j, $this->A[$RL[$i]][$j]);
|
||||
$R->set($i - $i0, $j, $this->A[$i][$CL[$j]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1013,6 +1013,7 @@ class Matrix
|
|||
if ($this->n == $B->m) {
|
||||
$C = new self($this->m, $B->n);
|
||||
for ($j = 0; $j < $B->n; ++$j) {
|
||||
$Bcolj = [];
|
||||
for ($k = 0; $k < $this->n; ++$k) {
|
||||
$Bcolj[$k] = $B->A[$k][$j];
|
||||
}
|
||||
|
|
|
@ -125,6 +125,7 @@ class QRDecomposition
|
|||
*/
|
||||
public function getH()
|
||||
{
|
||||
$H = [];
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
if ($i >= $j) {
|
||||
|
@ -147,6 +148,7 @@ class QRDecomposition
|
|||
*/
|
||||
public function getR()
|
||||
{
|
||||
$R = [];
|
||||
for ($i = 0; $i < $this->n; ++$i) {
|
||||
for ($j = 0; $j < $this->n; ++$j) {
|
||||
if ($i < $j) {
|
||||
|
@ -171,6 +173,7 @@ class QRDecomposition
|
|||
*/
|
||||
public function getQ()
|
||||
{
|
||||
$Q = [];
|
||||
for ($k = $this->n - 1; $k >= 0; --$k) {
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
$Q[$i][$k] = 0.0;
|
||||
|
|
|
@ -126,7 +126,7 @@ class PolynomialBestFit extends BestFit
|
|||
// calculate sums
|
||||
$x_sum = array_sum($xValues);
|
||||
$y_sum = array_sum($yValues);
|
||||
$xx_sum = $xy_sum = 0;
|
||||
$xx_sum = $xy_sum = $yy_sum = 0;
|
||||
for ($i = 0; $i < $this->valueCount; ++$i) {
|
||||
$xy_sum += $xValues[$i] * $yValues[$i];
|
||||
$xx_sum += $xValues[$i] * $xValues[$i];
|
||||
|
@ -140,6 +140,8 @@ class PolynomialBestFit extends BestFit
|
|||
* a series of x-y data points using least squares.
|
||||
*
|
||||
*/
|
||||
$A = [];
|
||||
$B = [];
|
||||
for ($i = 0; $i < $this->valueCount; ++$i) {
|
||||
for ($j = 0; $j <= $order; ++$j) {
|
||||
$A[$i][$j] = pow($xValues[$i], $j);
|
||||
|
|
|
@ -367,6 +367,8 @@ class AutoFilter
|
|||
}
|
||||
$returnVal = ($join == AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND);
|
||||
foreach ($dataSet as $rule) {
|
||||
$retVal = false;
|
||||
|
||||
if (is_numeric($rule['value'])) {
|
||||
// Numeric values are tested using the appropriate operator
|
||||
switch ($rule['operator']) {
|
||||
|
@ -747,6 +749,8 @@ class AutoFilter
|
|||
} else {
|
||||
// Date based
|
||||
if ($dynamicRuleType[0] == 'M' || $dynamicRuleType[0] == 'Q') {
|
||||
$periodType = '';
|
||||
$period = 0;
|
||||
// Month or Quarter
|
||||
sscanf($dynamicRuleType, '%[A-Z]%d', $periodType, $period);
|
||||
if ($periodType == 'M') {
|
||||
|
|
Loading…
Reference in New Issue