Skip to content

Commit 3982ce2

Browse files
committed
Remove unused variables and parameters
1 parent 782b4e4 commit 3982ce2

File tree

26 files changed

+46
-105
lines changed

26 files changed

+46
-105
lines changed

src/PhpSpreadsheet/Calculation.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3512,23 +3512,23 @@ private function processTokenStack($tokens, $cellID = null, Cell $pCell = null)
35123512

35133513
break;
35143514
case '+': // Addition
3515-
$this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'plusEquals', $stack);
3515+
$this->executeNumericBinaryOperation($operand1, $operand2, $token, 'plusEquals', $stack);
35163516

35173517
break;
35183518
case '-': // Subtraction
3519-
$this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'minusEquals', $stack);
3519+
$this->executeNumericBinaryOperation($operand1, $operand2, $token, 'minusEquals', $stack);
35203520

35213521
break;
35223522
case '*': // Multiplication
3523-
$this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayTimesEquals', $stack);
3523+
$this->executeNumericBinaryOperation($operand1, $operand2, $token, 'arrayTimesEquals', $stack);
35243524

35253525
break;
35263526
case '/': // Division
3527-
$this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayRightDivide', $stack);
3527+
$this->executeNumericBinaryOperation($operand1, $operand2, $token, 'arrayRightDivide', $stack);
35283528

35293529
break;
35303530
case '^': // Exponential
3531-
$this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'power', $stack);
3531+
$this->executeNumericBinaryOperation($operand1, $operand2, $token, 'power', $stack);
35323532

35333533
break;
35343534
case '&': // Concatenation
@@ -3606,7 +3606,7 @@ private function processTokenStack($tokens, $cellID = null, Cell $pCell = null)
36063606
$this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
36073607
$stack->push('Value', $result);
36083608
} else {
3609-
$this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack);
3609+
$this->executeNumericBinaryOperation($multiplier, $arg, '*', 'arrayTimesEquals', $stack);
36103610
}
36113611
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $token, $matches)) {
36123612
$cellRef = null;
@@ -3985,13 +3985,15 @@ private function strcmpLowercaseFirst($str1, $str2)
39853985
}
39863986

39873987
/**
3988-
* @param string $matrixFunction
3989-
* @param null|string $cellID
39903988
* @param mixed $operand1
39913989
* @param mixed $operand2
39923990
* @param mixed $operation
3991+
* @param string $matrixFunction
3992+
* @param mixed $stack
3993+
*
3994+
* @return bool
39933995
*/
3994-
private function executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, &$stack)
3996+
private function executeNumericBinaryOperation($operand1, $operand2, $operation, $matrixFunction, &$stack)
39953997
{
39963998
// Validate the two operands
39973999
if (!$this->validateBinaryOperand($operand1, $stack)) {

src/PhpSpreadsheet/Cell.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ public function getCalculatedValue($resetLog = true)
270270
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) {
271271
return $this->calculatedValue; // Fallback for calculations referencing external files.
272272
}
273-
$result = '#N/A';
274273

275274
throw new Calculation\Exception(
276275
$this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage()

src/PhpSpreadsheet/Chart/Renderer/JpGraph.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ private function renderLegend()
191191
$legend = $this->chart->getLegend();
192192
if ($legend !== null) {
193193
$legendPosition = $legend->getPosition();
194-
$legendOverlay = $legend->getOverlay();
195194
switch ($legendPosition) {
196195
case 'r':
197196
$this->graph->legend->SetPos(0.01, 0.5, 'right', 'center'); // right
@@ -257,7 +256,7 @@ private function renderCartesianPlotArea($type = 'textlin')
257256
}
258257
}
259258

260-
private function renderPiePlotArea($doughnut = false)
259+
private function renderPiePlotArea()
261260
{
262261
$this->graph = new \PieGraph(self::$width, self::$height);
263262

@@ -608,7 +607,7 @@ private function renderBubbleChart($groupCount)
608607

609608
private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false)
610609
{
611-
$this->renderPiePlotArea($doughnut);
610+
$this->renderPiePlotArea();
612611

613612
$iLimit = ($multiplePlots) ? $groupCount : 1;
614613
for ($groupID = 0; $groupID < $iLimit; ++$groupID) {

src/PhpSpreadsheet/Helper/Html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ public function toRichTextObject($html)
604604
$dom = new DOMDocument();
605605
// Load the HTML file into the DOM object
606606
// Note the use of error suppression, because typically this will be an html fragment, so not fully valid markup
607-
$loaded = @$dom->loadHTML($html);
607+
@$dom->loadHTML($html);
608608

609609
// Discard excess white space
610610
$dom->preserveWhiteSpace = false;

src/PhpSpreadsheet/Reader/Gnumeric.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace PhpOffice\PhpSpreadsheet\Reader;
44

5-
use DateTimeZone;
65
use PhpOffice\PhpSpreadsheet\Cell;
76
use PhpOffice\PhpSpreadsheet\NamedRange;
87
use PhpOffice\PhpSpreadsheet\ReferenceHelper;
@@ -195,9 +194,6 @@ public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
195194
{
196195
File::assertFile($pFilename);
197196

198-
$timezoneObj = new DateTimeZone('Europe/London');
199-
$GMT = new DateTimeZone('UTC');
200-
201197
$gFileData = $this->gzfileGetContents($pFilename);
202198

203199
$xml = simplexml_load_string($this->securityScan($gFileData), 'SimpleXMLElement', Settings::getLibXmlLoaderOptions());

src/PhpSpreadsheet/Reader/Html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ protected function processDomElement(DOMNode $element, Worksheet $sheet, &$row,
484484
case 'body':
485485
$row = 1;
486486
$column = 'A';
487-
$content = '';
487+
$cellContent = '';
488488
$this->tableLevel = 0;
489489
$this->processDomElement($child, $sheet, $row, $column, $cellContent);
490490

src/PhpSpreadsheet/Reader/Ods.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function listWorksheetInfo($pFilename)
153153
}
154154

155155
$xml = new XMLReader();
156-
$res = $xml->xml(
156+
$xml->xml(
157157
$this->securityScanFile('zip://' . realpath($pFilename) . '#content.xml'),
158158
null,
159159
Settings::getLibXmlLoaderOptions()

src/PhpSpreadsheet/Reader/Slk.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ public function listWorksheetInfo($pFilename)
126126
$worksheetInfo[0]['totalRows'] = 0;
127127
$worksheetInfo[0]['totalColumns'] = 0;
128128

129-
// Loop through file
130-
$rowData = [];
131-
132129
// loop through one row (line) at a time in the file
133130
$rowIndex = 0;
134131
while (($rowData = fgets($fileHandle)) !== false) {
@@ -221,7 +218,6 @@ public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
221218
$toFormats = ['-', ' '];
222219

223220
// Loop through file
224-
$rowData = [];
225221
$column = $row = '';
226222

227223
// loop through one row (line) at a time in the file

src/PhpSpreadsheet/Reader/Xlsx.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function listWorksheetInfo($pFilename)
200200
$fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'), 'id')];
201201

202202
$xml = new XMLReader();
203-
$res = $xml->xml(
203+
$xml->xml(
204204
$this->securityScanFile(
205205
'zip://' . File::realpath($pFilename) . '#' . "$dir/$fileWorksheet"
206206
),

src/PhpSpreadsheet/Reader/Xml.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace PhpOffice\PhpSpreadsheet\Reader;
44

5-
use DateTimeZone;
65
use PhpOffice\PhpSpreadsheet\Cell;
76
use PhpOffice\PhpSpreadsheet\Document\Properties;
87
use PhpOffice\PhpSpreadsheet\RichText;
@@ -327,9 +326,6 @@ public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
327326
Alignment::HORIZONTAL_JUSTIFY,
328327
];
329328

330-
$timezoneObj = new DateTimeZone('Europe/London');
331-
$GMT = new DateTimeZone('UTC');
332-
333329
File::assertFile($pFilename);
334330
if (!$this->canRead($pFilename)) {
335331
throw new Exception($pFilename . ' is an Invalid Spreadsheet file.');
@@ -648,10 +644,6 @@ public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
648644
$cellDataFormula = '';
649645
if (isset($cell_ss['Formula'])) {
650646
$cellDataFormula = $cell_ss['Formula'];
651-
// added this as a check for array formulas
652-
if (isset($cell_ss['ArrayRange'])) {
653-
$cellDataCSEFormula = $cell_ss['ArrayRange'];
654-
}
655647
$hasCalculatedValue = true;
656648
}
657649
if (isset($cell->Data)) {
@@ -792,9 +784,6 @@ public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
792784
}
793785

794786
if ($rowHasData) {
795-
if (isset($row_ss['StyleID'])) {
796-
$rowStyle = $row_ss['StyleID'];
797-
}
798787
if (isset($row_ss['Height'])) {
799788
$rowHeight = $row_ss['Height'];
800789
$spreadsheet->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight);

0 commit comments

Comments
 (0)