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