From 3982ce29444024cfc9c05580faa18dae522fba55 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Sun, 29 Oct 2017 14:09:38 +0900 Subject: [PATCH] Remove unused variables and parameters --- src/PhpSpreadsheet/Calculation.php | 20 ++++++++++-------- src/PhpSpreadsheet/Cell.php | 1 - src/PhpSpreadsheet/Chart/Renderer/JpGraph.php | 5 ++--- src/PhpSpreadsheet/Helper/Html.php | 2 +- src/PhpSpreadsheet/Reader/Gnumeric.php | 4 ---- src/PhpSpreadsheet/Reader/Html.php | 2 +- src/PhpSpreadsheet/Reader/Ods.php | 2 +- src/PhpSpreadsheet/Reader/Slk.php | 4 ---- src/PhpSpreadsheet/Reader/Xlsx.php | 2 +- src/PhpSpreadsheet/Reader/Xml.php | 11 ---------- src/PhpSpreadsheet/Style/NumberFormat.php | 4 ---- src/PhpSpreadsheet/Worksheet.php | 11 ++-------- src/PhpSpreadsheet/Writer/Ods/MetaInf.php | 8 +------ src/PhpSpreadsheet/Writer/Ods/Settings.php | 4 ---- src/PhpSpreadsheet/Writer/Ods/Styles.php | 4 ---- src/PhpSpreadsheet/Writer/Pdf/Dompdf.php | 2 -- src/PhpSpreadsheet/Writer/Pdf/Mpdf.php | 2 -- src/PhpSpreadsheet/Writer/Xls.php | 2 +- src/PhpSpreadsheet/Writer/Xlsx.php | 2 +- src/PhpSpreadsheet/Writer/Xlsx/Chart.php | 20 +++++++----------- src/PhpSpreadsheet/Writer/Xlsx/Drawing.php | 3 +-- src/PhpSpreadsheet/Writer/Xlsx/Workbook.php | 3 --- .../PhpSpreadsheetTests/Chart/LayoutTest.php | 2 +- .../PhpSpreadsheetTests/Chart/LegendTest.php | 6 +++--- .../Worksheet/AutoFilter/ColumnTest.php | 4 ++-- .../Worksheet/AutoFilterTest.php | 21 +++++++++---------- 26 files changed, 46 insertions(+), 105 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index 17739346..d8d3f660 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -3512,23 +3512,23 @@ class Calculation break; case '+': // Addition - $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'plusEquals', $stack); + $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'plusEquals', $stack); break; case '-': // Subtraction - $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'minusEquals', $stack); + $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'minusEquals', $stack); break; case '*': // Multiplication - $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayTimesEquals', $stack); + $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'arrayTimesEquals', $stack); break; case '/': // Division - $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayRightDivide', $stack); + $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'arrayRightDivide', $stack); break; case '^': // Exponential - $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'power', $stack); + $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'power', $stack); break; case '&': // Concatenation @@ -3606,7 +3606,7 @@ class Calculation $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); $stack->push('Value', $result); } else { - $this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack); + $this->executeNumericBinaryOperation($multiplier, $arg, '*', 'arrayTimesEquals', $stack); } } elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $token, $matches)) { $cellRef = null; @@ -3985,13 +3985,15 @@ class Calculation } /** - * @param string $matrixFunction - * @param null|string $cellID * @param mixed $operand1 * @param mixed $operand2 * @param mixed $operation + * @param string $matrixFunction + * @param mixed $stack + * + * @return bool */ - private function executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, &$stack) + private function executeNumericBinaryOperation($operand1, $operand2, $operation, $matrixFunction, &$stack) { // Validate the two operands if (!$this->validateBinaryOperand($operand1, $stack)) { diff --git a/src/PhpSpreadsheet/Cell.php b/src/PhpSpreadsheet/Cell.php index 235ec73d..f863f5fb 100644 --- a/src/PhpSpreadsheet/Cell.php +++ b/src/PhpSpreadsheet/Cell.php @@ -270,7 +270,6 @@ class Cell if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) { return $this->calculatedValue; // Fallback for calculations referencing external files. } - $result = '#N/A'; throw new Calculation\Exception( $this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage() diff --git a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php index 71a9f4a9..2ddff99e 100644 --- a/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php +++ b/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php @@ -191,7 +191,6 @@ class JpGraph implements IRenderer $legend = $this->chart->getLegend(); if ($legend !== null) { $legendPosition = $legend->getPosition(); - $legendOverlay = $legend->getOverlay(); switch ($legendPosition) { case 'r': $this->graph->legend->SetPos(0.01, 0.5, 'right', 'center'); // right @@ -257,7 +256,7 @@ class JpGraph implements IRenderer } } - private function renderPiePlotArea($doughnut = false) + private function renderPiePlotArea() { $this->graph = new \PieGraph(self::$width, self::$height); @@ -608,7 +607,7 @@ class JpGraph implements IRenderer private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false) { - $this->renderPiePlotArea($doughnut); + $this->renderPiePlotArea(); $iLimit = ($multiplePlots) ? $groupCount : 1; for ($groupID = 0; $groupID < $iLimit; ++$groupID) { diff --git a/src/PhpSpreadsheet/Helper/Html.php b/src/PhpSpreadsheet/Helper/Html.php index 457b4be8..284592c8 100644 --- a/src/PhpSpreadsheet/Helper/Html.php +++ b/src/PhpSpreadsheet/Helper/Html.php @@ -604,7 +604,7 @@ class Html $dom = new DOMDocument(); // Load the HTML file into the DOM object // Note the use of error suppression, because typically this will be an html fragment, so not fully valid markup - $loaded = @$dom->loadHTML($html); + @$dom->loadHTML($html); // Discard excess white space $dom->preserveWhiteSpace = false; diff --git a/src/PhpSpreadsheet/Reader/Gnumeric.php b/src/PhpSpreadsheet/Reader/Gnumeric.php index 2baf292c..b688973f 100644 --- a/src/PhpSpreadsheet/Reader/Gnumeric.php +++ b/src/PhpSpreadsheet/Reader/Gnumeric.php @@ -2,7 +2,6 @@ namespace PhpOffice\PhpSpreadsheet\Reader; -use DateTimeZone; use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\NamedRange; use PhpOffice\PhpSpreadsheet\ReferenceHelper; @@ -195,9 +194,6 @@ class Gnumeric extends BaseReader implements IReader { File::assertFile($pFilename); - $timezoneObj = new DateTimeZone('Europe/London'); - $GMT = new DateTimeZone('UTC'); - $gFileData = $this->gzfileGetContents($pFilename); $xml = simplexml_load_string($this->securityScan($gFileData), 'SimpleXMLElement', Settings::getLibXmlLoaderOptions()); diff --git a/src/PhpSpreadsheet/Reader/Html.php b/src/PhpSpreadsheet/Reader/Html.php index a38bb3b7..c9153bed 100644 --- a/src/PhpSpreadsheet/Reader/Html.php +++ b/src/PhpSpreadsheet/Reader/Html.php @@ -484,7 +484,7 @@ class Html extends BaseReader implements IReader case 'body': $row = 1; $column = 'A'; - $content = ''; + $cellContent = ''; $this->tableLevel = 0; $this->processDomElement($child, $sheet, $row, $column, $cellContent); diff --git a/src/PhpSpreadsheet/Reader/Ods.php b/src/PhpSpreadsheet/Reader/Ods.php index 48edc43d..45f4f030 100644 --- a/src/PhpSpreadsheet/Reader/Ods.php +++ b/src/PhpSpreadsheet/Reader/Ods.php @@ -153,7 +153,7 @@ class Ods extends BaseReader implements IReader } $xml = new XMLReader(); - $res = $xml->xml( + $xml->xml( $this->securityScanFile('zip://' . realpath($pFilename) . '#content.xml'), null, Settings::getLibXmlLoaderOptions() diff --git a/src/PhpSpreadsheet/Reader/Slk.php b/src/PhpSpreadsheet/Reader/Slk.php index ea69d29f..f316e1a0 100644 --- a/src/PhpSpreadsheet/Reader/Slk.php +++ b/src/PhpSpreadsheet/Reader/Slk.php @@ -126,9 +126,6 @@ class Slk extends BaseReader implements IReader $worksheetInfo[0]['totalRows'] = 0; $worksheetInfo[0]['totalColumns'] = 0; - // Loop through file - $rowData = []; - // loop through one row (line) at a time in the file $rowIndex = 0; while (($rowData = fgets($fileHandle)) !== false) { @@ -221,7 +218,6 @@ class Slk extends BaseReader implements IReader $toFormats = ['-', ' ']; // Loop through file - $rowData = []; $column = $row = ''; // loop through one row (line) at a time in the file diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index ece5d1e6..4365d4db 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -200,7 +200,7 @@ class Xlsx extends BaseReader implements IReader $fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'), 'id')]; $xml = new XMLReader(); - $res = $xml->xml( + $xml->xml( $this->securityScanFile( 'zip://' . File::realpath($pFilename) . '#' . "$dir/$fileWorksheet" ), diff --git a/src/PhpSpreadsheet/Reader/Xml.php b/src/PhpSpreadsheet/Reader/Xml.php index cfd18388..6124761b 100644 --- a/src/PhpSpreadsheet/Reader/Xml.php +++ b/src/PhpSpreadsheet/Reader/Xml.php @@ -2,7 +2,6 @@ namespace PhpOffice\PhpSpreadsheet\Reader; -use DateTimeZone; use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Document\Properties; use PhpOffice\PhpSpreadsheet\RichText; @@ -327,9 +326,6 @@ class Xml extends BaseReader implements IReader Alignment::HORIZONTAL_JUSTIFY, ]; - $timezoneObj = new DateTimeZone('Europe/London'); - $GMT = new DateTimeZone('UTC'); - File::assertFile($pFilename); if (!$this->canRead($pFilename)) { throw new Exception($pFilename . ' is an Invalid Spreadsheet file.'); @@ -648,10 +644,6 @@ class Xml extends BaseReader implements IReader $cellDataFormula = ''; if (isset($cell_ss['Formula'])) { $cellDataFormula = $cell_ss['Formula']; - // added this as a check for array formulas - if (isset($cell_ss['ArrayRange'])) { - $cellDataCSEFormula = $cell_ss['ArrayRange']; - } $hasCalculatedValue = true; } if (isset($cell->Data)) { @@ -792,9 +784,6 @@ class Xml extends BaseReader implements IReader } if ($rowHasData) { - if (isset($row_ss['StyleID'])) { - $rowStyle = $row_ss['StyleID']; - } if (isset($row_ss['Height'])) { $rowHeight = $row_ss['Height']; $spreadsheet->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight); diff --git a/src/PhpSpreadsheet/Style/NumberFormat.php b/src/PhpSpreadsheet/Style/NumberFormat.php index 3fc3696d..8147d4d6 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat.php +++ b/src/PhpSpreadsheet/Style/NumberFormat.php @@ -722,7 +722,6 @@ class NumberFormat extends Supervisor implements IComparable } if (preg_match('/\[\$(.*)\]/u', $format, $m)) { // Currency or Accounting - $currencyFormat = $m[0]; $currencyCode = $m[1]; list($currencyCode) = explode('-', $currencyCode); if ($currencyCode == '') { @@ -733,9 +732,6 @@ class NumberFormat extends Supervisor implements IComparable } } - // Escape any escaped slashes to a single slash - $format = preg_replace('/\\\\/u', '\\', $format); - // Additional formatting provided by callback function if ($callBack !== null) { list($writerInstance, $function) = $callBack; diff --git a/src/PhpSpreadsheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet.php index 1fdaeb80..4308e01a 100644 --- a/src/PhpSpreadsheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet.php @@ -1303,8 +1303,6 @@ class Worksheet implements IComparable } elseif (strpos($pCoordinate, '$') !== false) { throw new Exception('Cell coordinate must not be absolute.'); } - // Coordinates - $aCoordinates = Cell::coordinateFromString($pCoordinate); // Cell exists? return $this->cellCollection->has($pCoordinate); @@ -1528,9 +1526,6 @@ class Worksheet implements IComparable */ public function duplicateStyle(Style $pCellStyle, $pRange) { - // make sure we have a real style and not supervisor - $style = $pCellStyle->getIsSupervisor() ? $pCellStyle->getSharedComponent() : $pCellStyle; - // Add the style to the workbook if necessary $workbook = $this->parent; if ($existingStyle = $this->parent->getCellXfByHashCode($pCellStyle->getHashCode())) { @@ -1862,14 +1857,12 @@ class Worksheet implements IComparable * @param int $pRow1 Numeric row coordinate of the first cell * @param int $pColumn2 Numeric column coordinate of the last cell (A = 0) * @param int $pRow2 Numeric row coordinate of the last cell - * @param string $pPassword Password to unlock the protection - * @param bool $pAlreadyHashed If the password has already been hashed, set this to true * * @throws Exception * * @return Worksheet */ - public function unprotectCellsByColumnAndRow($pColumn1, $pRow1, $pColumn2, $pRow2, $pPassword, $pAlreadyHashed = false) + public function unprotectCellsByColumnAndRow($pColumn1, $pRow1, $pColumn2, $pRow2) { $cellRange = Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . Cell::stringFromColumnIndex($pColumn2) . $pRow2; @@ -1908,7 +1901,7 @@ class Worksheet implements IComparable */ public function setAutoFilter($pValue) { - $pRange = strtoupper($pValue); + $pValue = strtoupper($pValue); if (is_string($pValue)) { $this->autoFilter->setRange($pValue); } elseif (is_object($pValue) && ($pValue instanceof Worksheet\AutoFilter)) { diff --git a/src/PhpSpreadsheet/Writer/Ods/MetaInf.php b/src/PhpSpreadsheet/Writer/Ods/MetaInf.php index c3a05591..7336b4ea 100644 --- a/src/PhpSpreadsheet/Writer/Ods/MetaInf.php +++ b/src/PhpSpreadsheet/Writer/Ods/MetaInf.php @@ -10,18 +10,12 @@ class MetaInf extends WriterPart /** * Write META-INF/manifest.xml to XML format. * - * @param Spreadsheet $spreadsheet - * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception * * @return string XML Output */ - public function writeManifest(Spreadsheet $spreadsheet = null) + public function writeManifest() { - if (!$spreadsheet) { - $spreadsheet = $this->getParentWriter()->getSpreadsheet(); - } - $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); diff --git a/src/PhpSpreadsheet/Writer/Ods/Settings.php b/src/PhpSpreadsheet/Writer/Ods/Settings.php index 81595dc4..18f7ee6d 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Settings.php +++ b/src/PhpSpreadsheet/Writer/Ods/Settings.php @@ -18,10 +18,6 @@ class Settings extends WriterPart */ public function write(Spreadsheet $spreadsheet = null) { - if (!$spreadsheet) { - $spreadsheet = $this->getParentWriter()->getSpreadsheet(); - } - $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); diff --git a/src/PhpSpreadsheet/Writer/Ods/Styles.php b/src/PhpSpreadsheet/Writer/Ods/Styles.php index d221718c..eaf5cad9 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Styles.php +++ b/src/PhpSpreadsheet/Writer/Ods/Styles.php @@ -18,10 +18,6 @@ class Styles extends WriterPart */ public function write(Spreadsheet $spreadsheet = null) { - if (!$spreadsheet) { - $spreadsheet = $this->getParentWriter()->getSpreadsheet(); - } - $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); diff --git a/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php b/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php index 761c90cd..0872840e 100644 --- a/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php +++ b/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php @@ -27,12 +27,10 @@ class Dompdf extends Pdf implements IWriter $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation() == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); - $printMargins = $this->spreadsheet->getSheet(0)->getPageMargins(); } else { $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); - $printMargins = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageMargins(); } $orientation = ($orientation == 'L') ? 'landscape' : 'portrait'; diff --git a/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php b/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php index e9289bcd..cc829b1f 100644 --- a/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php +++ b/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php @@ -29,12 +29,10 @@ class Mpdf extends Pdf implements IWriter $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation() == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); - $printMargins = $this->spreadsheet->getSheet(0)->getPageMargins(); } else { $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); - $printMargins = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageMargins(); } $this->setOrientation($orientation); diff --git a/src/PhpSpreadsheet/Writer/Xls.php b/src/PhpSpreadsheet/Writer/Xls.php index ec042424..4fca377e 100644 --- a/src/PhpSpreadsheet/Writer/Xls.php +++ b/src/PhpSpreadsheet/Writer/Xls.php @@ -220,7 +220,7 @@ class Xls extends BaseWriter implements IWriter $root = new Root(time(), time(), $arrRootData); // save the OLE file - $res = $root->save($pFilename); + $root->save($pFilename); Functions::setReturnDateType($saveDateReturnType); Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); diff --git a/src/PhpSpreadsheet/Writer/Xlsx.php b/src/PhpSpreadsheet/Writer/Xlsx.php index f639fdc8..174180f5 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx.php +++ b/src/PhpSpreadsheet/Writer/Xlsx.php @@ -308,7 +308,7 @@ class Xlsx extends BaseWriter implements IWriter $zip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->spreadSheet->getSheet($i), $chartRef1, $this->includeCharts)); // Drawings - $zip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->spreadSheet->getSheet($i), $chartRef2, $this->includeCharts)); + $zip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->spreadSheet->getSheet($i), $this->includeCharts)); } // Add comment relationship parts diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php index 175059f9..e78fbd2a 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Chart.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Chart.php @@ -249,7 +249,7 @@ class Chart extends WriterPart $objWriter->endElement(); } - $this->writePlotGroup($plotGroup, $chartType, $objWriter, $catIsMultiLevelSeries, $valIsMultiLevelSeries, $plotGroupingType, $pSheet); + $this->writePlotGroup($plotGroup, $chartType, $objWriter, $catIsMultiLevelSeries, $valIsMultiLevelSeries, $plotGroupingType); } } @@ -325,12 +325,12 @@ class Chart extends WriterPart if (($chartType !== DataSeries::TYPE_PIECHART) && ($chartType !== DataSeries::TYPE_PIECHART_3D) && ($chartType !== DataSeries::TYPE_DONUTCHART)) { if ($chartType === DataSeries::TYPE_BUBBLECHART) { - $this->writeValueAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines); + $this->writeValueAxis($objWriter, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $majorGridlines, $minorGridlines); } else { - $this->writeCategoryAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis); + $this->writeCategoryAxis($objWriter, $xAxisLabel, $id1, $id2, $catIsMultiLevelSeries, $yAxis); } - $this->writeValueAxis($objWriter, $plotArea, $yAxisLabel, $chartType, $id1, $id2, $valIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines); + $this->writeValueAxis($objWriter, $yAxisLabel, $chartType, $id1, $id2, $valIsMultiLevelSeries, $xAxis, $majorGridlines, $minorGridlines); } $objWriter->endElement(); @@ -390,18 +390,15 @@ class Chart extends WriterPart * Write Category Axis. * * @param XMLWriter $objWriter XML Writer - * @param PlotArea $plotArea * @param Title $xAxisLabel - * @param string $groupType Chart type * @param string $id1 * @param string $id2 * @param bool $isMultiLevelSeries - * @param mixed $xAxis * @param mixed $yAxis * * @throws WriterException */ - private function writeCategoryAxis($objWriter, PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis) + private function writeCategoryAxis($objWriter, $xAxisLabel, $id1, $id2, $isMultiLevelSeries, $yAxis) { $objWriter->startElement('c:catAx'); @@ -513,20 +510,18 @@ class Chart extends WriterPart * Write Value Axis. * * @param XMLWriter $objWriter XML Writer - * @param PlotArea $plotArea * @param Title $yAxisLabel * @param string $groupType Chart type * @param string $id1 * @param string $id2 * @param bool $isMultiLevelSeries * @param mixed $xAxis - * @param mixed $yAxis * @param mixed $majorGridlines * @param mixed $minorGridlines * * @throws WriterException */ - private function writeValueAxis($objWriter, PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines) + private function writeValueAxis($objWriter, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $majorGridlines, $minorGridlines) { $objWriter->startElement('c:valAx'); @@ -1037,11 +1032,10 @@ class Chart extends WriterPart * @param bool &$catIsMultiLevelSeries Is category a multi-series category * @param bool &$valIsMultiLevelSeries Is value set a multi-series set * @param string &$plotGroupingType Type of grouping for multi-series values - * @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet * * @throws WriterException */ - private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet) + private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType) { if ($plotGroup === null) { return; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php b/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php index 204d9474..1f9b827c 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php @@ -15,14 +15,13 @@ class Drawing extends WriterPart * Write drawings to XML format. * * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet - * @param int &$chartRef Chart ID * @param bool $includeCharts Flag indicating if we should include drawing details for charts * * @throws WriterException * * @return string XML Output */ - public function writeDrawings(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet, &$chartRef, $includeCharts = false) + public function writeDrawings(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet, $includeCharts = false) { // Create XML writer $objWriter = null; diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php b/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php index 852f7c39..dff5a10a 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php @@ -426,9 +426,6 @@ class Workbook extends WriterPart $objWriter->writeAttribute('name', '_xlnm.Print_Area'); $objWriter->writeAttribute('localSheetId', $pSheetId); - // Setting string - $settingString = ''; - // Print area $printArea = Cell::splitRange($pSheet->getPageSetup()->getPrintArea()); diff --git a/tests/PhpSpreadsheetTests/Chart/LayoutTest.php b/tests/PhpSpreadsheetTests/Chart/LayoutTest.php index 67cd5878..250a978a 100644 --- a/tests/PhpSpreadsheetTests/Chart/LayoutTest.php +++ b/tests/PhpSpreadsheetTests/Chart/LayoutTest.php @@ -22,7 +22,7 @@ class LayoutTest extends PHPUnit_Framework_TestCase $LayoutTargetValue = 'String'; $testInstance = new Layout(); - $setValue = $testInstance->setLayoutTarget($LayoutTargetValue); + $testInstance->setLayoutTarget($LayoutTargetValue); $result = $testInstance->getLayoutTarget(); self::assertEquals($LayoutTargetValue, $result); diff --git a/tests/PhpSpreadsheetTests/Chart/LegendTest.php b/tests/PhpSpreadsheetTests/Chart/LegendTest.php index 82d3243b..3fbf89e1 100644 --- a/tests/PhpSpreadsheetTests/Chart/LegendTest.php +++ b/tests/PhpSpreadsheetTests/Chart/LegendTest.php @@ -41,7 +41,7 @@ class LegendTest extends PHPUnit_Framework_TestCase $PositionValue = Legend::POSITION_BOTTOM; $testInstance = new Legend(); - $setValue = $testInstance->setPosition($PositionValue); + $testInstance->setPosition($PositionValue); $result = $testInstance->getPosition(); self::assertEquals($PositionValue, $result); @@ -82,7 +82,7 @@ class LegendTest extends PHPUnit_Framework_TestCase $PositionValue = Legend::XL_LEGEND_POSITION_CORNER; $testInstance = new Legend(); - $setValue = $testInstance->setPositionXL($PositionValue); + $testInstance->setPositionXL($PositionValue); $result = $testInstance->getPositionXL(); self::assertEquals($PositionValue, $result); @@ -119,7 +119,7 @@ class LegendTest extends PHPUnit_Framework_TestCase $OverlayValue = true; $testInstance = new Legend(); - $setValue = $testInstance->setOverlay($OverlayValue); + $testInstance->setOverlay($OverlayValue); $result = $testInstance->getOverlay(); self::assertEquals($OverlayValue, $result); diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php index cf9944fc..c10bcdf4 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php @@ -77,7 +77,7 @@ class ColumnTest extends PHPUnit_Framework_TestCase { $expectedResult = 'Unfiltered'; - $result = $this->testAutoFilterColumnObject->setFilterType($expectedResult); + $this->testAutoFilterColumnObject->setFilterType($expectedResult); } public function testGetJoin() @@ -102,7 +102,7 @@ class ColumnTest extends PHPUnit_Framework_TestCase { $expectedResult = 'Neither'; - $result = $this->testAutoFilterColumnObject->setJoin($expectedResult); + $this->testAutoFilterColumnObject->setJoin($expectedResult); } public function testSetAttributes() diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php index 3a922420..637358e5 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilterTest.php @@ -11,6 +11,9 @@ use PHPUnit_Framework_TestCase; class AutoFilterTest extends PHPUnit_Framework_TestCase { private $testInitialRange = 'H2:O256'; + /** + * @var AutoFilter + */ private $testAutoFilterObject; private $mockWorksheetObject; private $cellCollection; @@ -99,7 +102,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase { $expectedResult = 'A1'; - $result = $this->testAutoFilterObject->setRange($expectedResult); + $this->testAutoFilterObject->setRange($expectedResult); } public function testGetColumnsEmpty() @@ -133,7 +136,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase { $invalidColumn = 'G'; - $result = $this->testAutoFilterObject->getColumnOffset($invalidColumn); + $this->testAutoFilterObject->getColumnOffset($invalidColumn); } public function testSetColumnWithString() @@ -160,7 +163,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase { $invalidColumn = 'A'; - $result = $this->testAutoFilterObject->setColumn($invalidColumn); + $this->testAutoFilterObject->setColumn($invalidColumn); } public function testSetColumnWithColumnObject() @@ -187,9 +190,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase public function testSetInvalidColumnWithObject() { $invalidColumn = 'E'; - $columnObject = new AutoFilter\Column($invalidColumn); - - $result = $this->testAutoFilterObject->setColumn($invalidColumn); + $this->testAutoFilterObject->setColumn($invalidColumn); } /** @@ -198,9 +199,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase public function testSetColumnWithInvalidDataType() { $invalidColumn = 123.456; - $columnObject = new AutoFilter\Column($invalidColumn); - - $result = $this->testAutoFilterObject->setColumn($invalidColumn); + $this->testAutoFilterObject->setColumn($invalidColumn); } public function testGetColumns() @@ -269,8 +268,8 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase public function testGetColumnWithoutRangeSet() { // Clear the range - $result = $this->testAutoFilterObject->setRange(''); - $result = $this->testAutoFilterObject->getColumn('A'); + $this->testAutoFilterObject->setRange(''); + $this->testAutoFilterObject->getColumn('A'); } public function testClearRangeWithExistingColumns()