Remove unused variables and parameters

This commit is contained in:
Adrien Crivelli 2017-10-29 14:09:38 +09:00
parent 782b4e4fae
commit 3982ce2944
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
26 changed files with 46 additions and 105 deletions

View File

@ -3512,23 +3512,23 @@ class Calculation
break; break;
case '+': // Addition case '+': // Addition
$this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'plusEquals', $stack); $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'plusEquals', $stack);
break; break;
case '-': // Subtraction case '-': // Subtraction
$this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'minusEquals', $stack); $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'minusEquals', $stack);
break; break;
case '*': // Multiplication case '*': // Multiplication
$this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayTimesEquals', $stack); $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'arrayTimesEquals', $stack);
break; break;
case '/': // Division case '/': // Division
$this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayRightDivide', $stack); $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'arrayRightDivide', $stack);
break; break;
case '^': // Exponential case '^': // Exponential
$this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'power', $stack); $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'power', $stack);
break; break;
case '&': // Concatenation case '&': // Concatenation
@ -3606,7 +3606,7 @@ class Calculation
$this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
$stack->push('Value', $result); $stack->push('Value', $result);
} else { } else {
$this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack); $this->executeNumericBinaryOperation($multiplier, $arg, '*', 'arrayTimesEquals', $stack);
} }
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $token, $matches)) { } elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $token, $matches)) {
$cellRef = null; $cellRef = null;
@ -3985,13 +3985,15 @@ class Calculation
} }
/** /**
* @param string $matrixFunction
* @param null|string $cellID
* @param mixed $operand1 * @param mixed $operand1
* @param mixed $operand2 * @param mixed $operand2
* @param mixed $operation * @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 // Validate the two operands
if (!$this->validateBinaryOperand($operand1, $stack)) { if (!$this->validateBinaryOperand($operand1, $stack)) {

View File

@ -270,7 +270,6 @@ class Cell
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) { if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) {
return $this->calculatedValue; // Fallback for calculations referencing external files. return $this->calculatedValue; // Fallback for calculations referencing external files.
} }
$result = '#N/A';
throw new Calculation\Exception( throw new Calculation\Exception(
$this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage() $this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage()

View File

@ -191,7 +191,6 @@ class JpGraph implements IRenderer
$legend = $this->chart->getLegend(); $legend = $this->chart->getLegend();
if ($legend !== null) { if ($legend !== null) {
$legendPosition = $legend->getPosition(); $legendPosition = $legend->getPosition();
$legendOverlay = $legend->getOverlay();
switch ($legendPosition) { switch ($legendPosition) {
case 'r': case 'r':
$this->graph->legend->SetPos(0.01, 0.5, 'right', 'center'); // right $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); $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) private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false)
{ {
$this->renderPiePlotArea($doughnut); $this->renderPiePlotArea();
$iLimit = ($multiplePlots) ? $groupCount : 1; $iLimit = ($multiplePlots) ? $groupCount : 1;
for ($groupID = 0; $groupID < $iLimit; ++$groupID) { for ($groupID = 0; $groupID < $iLimit; ++$groupID) {

View File

@ -604,7 +604,7 @@ class Html
$dom = new DOMDocument(); $dom = new DOMDocument();
// Load the HTML file into the DOM object // 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 // 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 // Discard excess white space
$dom->preserveWhiteSpace = false; $dom->preserveWhiteSpace = false;

View File

@ -2,7 +2,6 @@
namespace PhpOffice\PhpSpreadsheet\Reader; namespace PhpOffice\PhpSpreadsheet\Reader;
use DateTimeZone;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell;
use PhpOffice\PhpSpreadsheet\NamedRange; use PhpOffice\PhpSpreadsheet\NamedRange;
use PhpOffice\PhpSpreadsheet\ReferenceHelper; use PhpOffice\PhpSpreadsheet\ReferenceHelper;
@ -195,9 +194,6 @@ class Gnumeric extends BaseReader implements IReader
{ {
File::assertFile($pFilename); File::assertFile($pFilename);
$timezoneObj = new DateTimeZone('Europe/London');
$GMT = new DateTimeZone('UTC');
$gFileData = $this->gzfileGetContents($pFilename); $gFileData = $this->gzfileGetContents($pFilename);
$xml = simplexml_load_string($this->securityScan($gFileData), 'SimpleXMLElement', Settings::getLibXmlLoaderOptions()); $xml = simplexml_load_string($this->securityScan($gFileData), 'SimpleXMLElement', Settings::getLibXmlLoaderOptions());

View File

@ -484,7 +484,7 @@ class Html extends BaseReader implements IReader
case 'body': case 'body':
$row = 1; $row = 1;
$column = 'A'; $column = 'A';
$content = ''; $cellContent = '';
$this->tableLevel = 0; $this->tableLevel = 0;
$this->processDomElement($child, $sheet, $row, $column, $cellContent); $this->processDomElement($child, $sheet, $row, $column, $cellContent);

View File

@ -153,7 +153,7 @@ class Ods extends BaseReader implements IReader
} }
$xml = new XMLReader(); $xml = new XMLReader();
$res = $xml->xml( $xml->xml(
$this->securityScanFile('zip://' . realpath($pFilename) . '#content.xml'), $this->securityScanFile('zip://' . realpath($pFilename) . '#content.xml'),
null, null,
Settings::getLibXmlLoaderOptions() Settings::getLibXmlLoaderOptions()

View File

@ -126,9 +126,6 @@ class Slk extends BaseReader implements IReader
$worksheetInfo[0]['totalRows'] = 0; $worksheetInfo[0]['totalRows'] = 0;
$worksheetInfo[0]['totalColumns'] = 0; $worksheetInfo[0]['totalColumns'] = 0;
// Loop through file
$rowData = [];
// loop through one row (line) at a time in the file // loop through one row (line) at a time in the file
$rowIndex = 0; $rowIndex = 0;
while (($rowData = fgets($fileHandle)) !== false) { while (($rowData = fgets($fileHandle)) !== false) {
@ -221,7 +218,6 @@ class Slk extends BaseReader implements IReader
$toFormats = ['-', ' ']; $toFormats = ['-', ' '];
// Loop through file // Loop through file
$rowData = [];
$column = $row = ''; $column = $row = '';
// loop through one row (line) at a time in the file // loop through one row (line) at a time in the file

View File

@ -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')]; $fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'), 'id')];
$xml = new XMLReader(); $xml = new XMLReader();
$res = $xml->xml( $xml->xml(
$this->securityScanFile( $this->securityScanFile(
'zip://' . File::realpath($pFilename) . '#' . "$dir/$fileWorksheet" 'zip://' . File::realpath($pFilename) . '#' . "$dir/$fileWorksheet"
), ),

View File

@ -2,7 +2,6 @@
namespace PhpOffice\PhpSpreadsheet\Reader; namespace PhpOffice\PhpSpreadsheet\Reader;
use DateTimeZone;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell;
use PhpOffice\PhpSpreadsheet\Document\Properties; use PhpOffice\PhpSpreadsheet\Document\Properties;
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText;
@ -327,9 +326,6 @@ class Xml extends BaseReader implements IReader
Alignment::HORIZONTAL_JUSTIFY, Alignment::HORIZONTAL_JUSTIFY,
]; ];
$timezoneObj = new DateTimeZone('Europe/London');
$GMT = new DateTimeZone('UTC');
File::assertFile($pFilename); File::assertFile($pFilename);
if (!$this->canRead($pFilename)) { if (!$this->canRead($pFilename)) {
throw new Exception($pFilename . ' is an Invalid Spreadsheet file.'); throw new Exception($pFilename . ' is an Invalid Spreadsheet file.');
@ -648,10 +644,6 @@ class Xml extends BaseReader implements IReader
$cellDataFormula = ''; $cellDataFormula = '';
if (isset($cell_ss['Formula'])) { if (isset($cell_ss['Formula'])) {
$cellDataFormula = $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; $hasCalculatedValue = true;
} }
if (isset($cell->Data)) { if (isset($cell->Data)) {
@ -792,9 +784,6 @@ class Xml extends BaseReader implements IReader
} }
if ($rowHasData) { if ($rowHasData) {
if (isset($row_ss['StyleID'])) {
$rowStyle = $row_ss['StyleID'];
}
if (isset($row_ss['Height'])) { if (isset($row_ss['Height'])) {
$rowHeight = $row_ss['Height']; $rowHeight = $row_ss['Height'];
$spreadsheet->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight); $spreadsheet->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight);

View File

@ -722,7 +722,6 @@ class NumberFormat extends Supervisor implements IComparable
} }
if (preg_match('/\[\$(.*)\]/u', $format, $m)) { if (preg_match('/\[\$(.*)\]/u', $format, $m)) {
// Currency or Accounting // Currency or Accounting
$currencyFormat = $m[0];
$currencyCode = $m[1]; $currencyCode = $m[1];
list($currencyCode) = explode('-', $currencyCode); list($currencyCode) = explode('-', $currencyCode);
if ($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 // Additional formatting provided by callback function
if ($callBack !== null) { if ($callBack !== null) {
list($writerInstance, $function) = $callBack; list($writerInstance, $function) = $callBack;

View File

@ -1303,8 +1303,6 @@ class Worksheet implements IComparable
} elseif (strpos($pCoordinate, '$') !== false) { } elseif (strpos($pCoordinate, '$') !== false) {
throw new Exception('Cell coordinate must not be absolute.'); throw new Exception('Cell coordinate must not be absolute.');
} }
// Coordinates
$aCoordinates = Cell::coordinateFromString($pCoordinate);
// Cell exists? // Cell exists?
return $this->cellCollection->has($pCoordinate); return $this->cellCollection->has($pCoordinate);
@ -1528,9 +1526,6 @@ class Worksheet implements IComparable
*/ */
public function duplicateStyle(Style $pCellStyle, $pRange) 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 // Add the style to the workbook if necessary
$workbook = $this->parent; $workbook = $this->parent;
if ($existingStyle = $this->parent->getCellXfByHashCode($pCellStyle->getHashCode())) { 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 $pRow1 Numeric row coordinate of the first cell
* @param int $pColumn2 Numeric column coordinate of the last cell (A = 0) * @param int $pColumn2 Numeric column coordinate of the last cell (A = 0)
* @param int $pRow2 Numeric row coordinate of the last cell * @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 * @throws Exception
* *
* @return Worksheet * @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; $cellRange = Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . Cell::stringFromColumnIndex($pColumn2) . $pRow2;
@ -1908,7 +1901,7 @@ class Worksheet implements IComparable
*/ */
public function setAutoFilter($pValue) public function setAutoFilter($pValue)
{ {
$pRange = strtoupper($pValue); $pValue = strtoupper($pValue);
if (is_string($pValue)) { if (is_string($pValue)) {
$this->autoFilter->setRange($pValue); $this->autoFilter->setRange($pValue);
} elseif (is_object($pValue) && ($pValue instanceof Worksheet\AutoFilter)) { } elseif (is_object($pValue) && ($pValue instanceof Worksheet\AutoFilter)) {

View File

@ -10,18 +10,12 @@ class MetaInf extends WriterPart
/** /**
* Write META-INF/manifest.xml to XML format. * Write META-INF/manifest.xml to XML format.
* *
* @param Spreadsheet $spreadsheet
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
* *
* @return string XML Output * @return string XML Output
*/ */
public function writeManifest(Spreadsheet $spreadsheet = null) public function writeManifest()
{ {
if (!$spreadsheet) {
$spreadsheet = $this->getParentWriter()->getSpreadsheet();
}
$objWriter = null; $objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) { if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());

View File

@ -18,10 +18,6 @@ class Settings extends WriterPart
*/ */
public function write(Spreadsheet $spreadsheet = null) public function write(Spreadsheet $spreadsheet = null)
{ {
if (!$spreadsheet) {
$spreadsheet = $this->getParentWriter()->getSpreadsheet();
}
$objWriter = null; $objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) { if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());

View File

@ -18,10 +18,6 @@ class Styles extends WriterPart
*/ */
public function write(Spreadsheet $spreadsheet = null) public function write(Spreadsheet $spreadsheet = null)
{ {
if (!$spreadsheet) {
$spreadsheet = $this->getParentWriter()->getSpreadsheet();
}
$objWriter = null; $objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) { if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());

View File

@ -27,12 +27,10 @@ class Dompdf extends Pdf implements IWriter
$orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation() $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation()
== PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->spreadsheet->getSheet(0)->getPageMargins();
} else { } else {
$orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
== PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageMargins();
} }
$orientation = ($orientation == 'L') ? 'landscape' : 'portrait'; $orientation = ($orientation == 'L') ? 'landscape' : 'portrait';

View File

@ -29,12 +29,10 @@ class Mpdf extends Pdf implements IWriter
$orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation() $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation()
== PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->spreadsheet->getSheet(0)->getPageMargins();
} else { } else {
$orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
== PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageMargins();
} }
$this->setOrientation($orientation); $this->setOrientation($orientation);

View File

@ -220,7 +220,7 @@ class Xls extends BaseWriter implements IWriter
$root = new Root(time(), time(), $arrRootData); $root = new Root(time(), time(), $arrRootData);
// save the OLE file // save the OLE file
$res = $root->save($pFilename); $root->save($pFilename);
Functions::setReturnDateType($saveDateReturnType); Functions::setReturnDateType($saveDateReturnType);
Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog($saveDebugLog);

View File

@ -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)); $zip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->spreadSheet->getSheet($i), $chartRef1, $this->includeCharts));
// Drawings // 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 // Add comment relationship parts

View File

@ -249,7 +249,7 @@ class Chart extends WriterPart
$objWriter->endElement(); $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_PIECHART) && ($chartType !== DataSeries::TYPE_PIECHART_3D) && ($chartType !== DataSeries::TYPE_DONUTCHART)) {
if ($chartType === DataSeries::TYPE_BUBBLECHART) { 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 { } 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(); $objWriter->endElement();
@ -390,18 +390,15 @@ class Chart extends WriterPart
* Write Category Axis. * Write Category Axis.
* *
* @param XMLWriter $objWriter XML Writer * @param XMLWriter $objWriter XML Writer
* @param PlotArea $plotArea
* @param Title $xAxisLabel * @param Title $xAxisLabel
* @param string $groupType Chart type
* @param string $id1 * @param string $id1
* @param string $id2 * @param string $id2
* @param bool $isMultiLevelSeries * @param bool $isMultiLevelSeries
* @param mixed $xAxis
* @param mixed $yAxis * @param mixed $yAxis
* *
* @throws WriterException * @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'); $objWriter->startElement('c:catAx');
@ -513,20 +510,18 @@ class Chart extends WriterPart
* Write Value Axis. * Write Value Axis.
* *
* @param XMLWriter $objWriter XML Writer * @param XMLWriter $objWriter XML Writer
* @param PlotArea $plotArea
* @param Title $yAxisLabel * @param Title $yAxisLabel
* @param string $groupType Chart type * @param string $groupType Chart type
* @param string $id1 * @param string $id1
* @param string $id2 * @param string $id2
* @param bool $isMultiLevelSeries * @param bool $isMultiLevelSeries
* @param mixed $xAxis * @param mixed $xAxis
* @param mixed $yAxis
* @param mixed $majorGridlines * @param mixed $majorGridlines
* @param mixed $minorGridlines * @param mixed $minorGridlines
* *
* @throws WriterException * @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'); $objWriter->startElement('c:valAx');
@ -1037,11 +1032,10 @@ class Chart extends WriterPart
* @param bool &$catIsMultiLevelSeries Is category a multi-series category * @param bool &$catIsMultiLevelSeries Is category a multi-series category
* @param bool &$valIsMultiLevelSeries Is value set a multi-series set * @param bool &$valIsMultiLevelSeries Is value set a multi-series set
* @param string &$plotGroupingType Type of grouping for multi-series values * @param string &$plotGroupingType Type of grouping for multi-series values
* @param \PhpOffice\PhpSpreadsheet\Worksheet $pSheet
* *
* @throws WriterException * @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) { if ($plotGroup === null) {
return; return;

View File

@ -15,14 +15,13 @@ class Drawing extends WriterPart
* Write drawings to XML format. * Write drawings to XML format.
* *
* @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet * @param \PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet
* @param int &$chartRef Chart ID
* @param bool $includeCharts Flag indicating if we should include drawing details for charts * @param bool $includeCharts Flag indicating if we should include drawing details for charts
* *
* @throws WriterException * @throws WriterException
* *
* @return string XML Output * @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 // Create XML writer
$objWriter = null; $objWriter = null;

View File

@ -426,9 +426,6 @@ class Workbook extends WriterPart
$objWriter->writeAttribute('name', '_xlnm.Print_Area'); $objWriter->writeAttribute('name', '_xlnm.Print_Area');
$objWriter->writeAttribute('localSheetId', $pSheetId); $objWriter->writeAttribute('localSheetId', $pSheetId);
// Setting string
$settingString = '';
// Print area // Print area
$printArea = Cell::splitRange($pSheet->getPageSetup()->getPrintArea()); $printArea = Cell::splitRange($pSheet->getPageSetup()->getPrintArea());

View File

@ -22,7 +22,7 @@ class LayoutTest extends PHPUnit_Framework_TestCase
$LayoutTargetValue = 'String'; $LayoutTargetValue = 'String';
$testInstance = new Layout(); $testInstance = new Layout();
$setValue = $testInstance->setLayoutTarget($LayoutTargetValue); $testInstance->setLayoutTarget($LayoutTargetValue);
$result = $testInstance->getLayoutTarget(); $result = $testInstance->getLayoutTarget();
self::assertEquals($LayoutTargetValue, $result); self::assertEquals($LayoutTargetValue, $result);

View File

@ -41,7 +41,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
$PositionValue = Legend::POSITION_BOTTOM; $PositionValue = Legend::POSITION_BOTTOM;
$testInstance = new Legend(); $testInstance = new Legend();
$setValue = $testInstance->setPosition($PositionValue); $testInstance->setPosition($PositionValue);
$result = $testInstance->getPosition(); $result = $testInstance->getPosition();
self::assertEquals($PositionValue, $result); self::assertEquals($PositionValue, $result);
@ -82,7 +82,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
$PositionValue = Legend::XL_LEGEND_POSITION_CORNER; $PositionValue = Legend::XL_LEGEND_POSITION_CORNER;
$testInstance = new Legend(); $testInstance = new Legend();
$setValue = $testInstance->setPositionXL($PositionValue); $testInstance->setPositionXL($PositionValue);
$result = $testInstance->getPositionXL(); $result = $testInstance->getPositionXL();
self::assertEquals($PositionValue, $result); self::assertEquals($PositionValue, $result);
@ -119,7 +119,7 @@ class LegendTest extends PHPUnit_Framework_TestCase
$OverlayValue = true; $OverlayValue = true;
$testInstance = new Legend(); $testInstance = new Legend();
$setValue = $testInstance->setOverlay($OverlayValue); $testInstance->setOverlay($OverlayValue);
$result = $testInstance->getOverlay(); $result = $testInstance->getOverlay();
self::assertEquals($OverlayValue, $result); self::assertEquals($OverlayValue, $result);

View File

@ -77,7 +77,7 @@ class ColumnTest extends PHPUnit_Framework_TestCase
{ {
$expectedResult = 'Unfiltered'; $expectedResult = 'Unfiltered';
$result = $this->testAutoFilterColumnObject->setFilterType($expectedResult); $this->testAutoFilterColumnObject->setFilterType($expectedResult);
} }
public function testGetJoin() public function testGetJoin()
@ -102,7 +102,7 @@ class ColumnTest extends PHPUnit_Framework_TestCase
{ {
$expectedResult = 'Neither'; $expectedResult = 'Neither';
$result = $this->testAutoFilterColumnObject->setJoin($expectedResult); $this->testAutoFilterColumnObject->setJoin($expectedResult);
} }
public function testSetAttributes() public function testSetAttributes()

View File

@ -11,6 +11,9 @@ use PHPUnit_Framework_TestCase;
class AutoFilterTest extends PHPUnit_Framework_TestCase class AutoFilterTest extends PHPUnit_Framework_TestCase
{ {
private $testInitialRange = 'H2:O256'; private $testInitialRange = 'H2:O256';
/**
* @var AutoFilter
*/
private $testAutoFilterObject; private $testAutoFilterObject;
private $mockWorksheetObject; private $mockWorksheetObject;
private $cellCollection; private $cellCollection;
@ -99,7 +102,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
{ {
$expectedResult = 'A1'; $expectedResult = 'A1';
$result = $this->testAutoFilterObject->setRange($expectedResult); $this->testAutoFilterObject->setRange($expectedResult);
} }
public function testGetColumnsEmpty() public function testGetColumnsEmpty()
@ -133,7 +136,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
{ {
$invalidColumn = 'G'; $invalidColumn = 'G';
$result = $this->testAutoFilterObject->getColumnOffset($invalidColumn); $this->testAutoFilterObject->getColumnOffset($invalidColumn);
} }
public function testSetColumnWithString() public function testSetColumnWithString()
@ -160,7 +163,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
{ {
$invalidColumn = 'A'; $invalidColumn = 'A';
$result = $this->testAutoFilterObject->setColumn($invalidColumn); $this->testAutoFilterObject->setColumn($invalidColumn);
} }
public function testSetColumnWithColumnObject() public function testSetColumnWithColumnObject()
@ -187,9 +190,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
public function testSetInvalidColumnWithObject() public function testSetInvalidColumnWithObject()
{ {
$invalidColumn = 'E'; $invalidColumn = 'E';
$columnObject = new AutoFilter\Column($invalidColumn); $this->testAutoFilterObject->setColumn($invalidColumn);
$result = $this->testAutoFilterObject->setColumn($invalidColumn);
} }
/** /**
@ -198,9 +199,7 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
public function testSetColumnWithInvalidDataType() public function testSetColumnWithInvalidDataType()
{ {
$invalidColumn = 123.456; $invalidColumn = 123.456;
$columnObject = new AutoFilter\Column($invalidColumn); $this->testAutoFilterObject->setColumn($invalidColumn);
$result = $this->testAutoFilterObject->setColumn($invalidColumn);
} }
public function testGetColumns() public function testGetColumns()
@ -269,8 +268,8 @@ class AutoFilterTest extends PHPUnit_Framework_TestCase
public function testGetColumnWithoutRangeSet() public function testGetColumnWithoutRangeSet()
{ {
// Clear the range // Clear the range
$result = $this->testAutoFilterObject->setRange(''); $this->testAutoFilterObject->setRange('');
$result = $this->testAutoFilterObject->getColumn('A'); $this->testAutoFilterObject->getColumn('A');
} }
public function testClearRangeWithExistingColumns() public function testClearRangeWithExistingColumns()