Declare arguments as required when they are

Closes #110
This commit is contained in:
Adrien Crivelli 2017-04-16 14:13:16 +09:00
parent 06ca8f9b04
commit 75d3bdb016
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
34 changed files with 130 additions and 140 deletions

View File

@ -118,7 +118,7 @@ class Cell
*
* @throws Exception
*/
public function __construct($pValue = null, $pDataType = null, Worksheet $pSheet = null)
public function __construct($pValue, $pDataType, Worksheet $pSheet)
{
// Initialise cell value
$this->value = $pValue;
@ -990,12 +990,8 @@ class Cell
*
* @throws Exception
*/
public static function setValueBinder(Cell\IValueBinder $binder = null)
public static function setValueBinder(Cell\IValueBinder $binder)
{
if ($binder === null) {
throw new Exception('A \\PhpOffice\\PhpSpreadsheet\\Cell\\IValueBinder is required for PhpSpreadsheet to function correctly.');
}
self::$valueBinder = $binder;
}

View File

@ -73,8 +73,9 @@ class Legend
/**
* Create a new Legend.
*
* @param mixed $position
* @param mixed $overlay
* @param string $position
* @param Layout|null $layout
* @param bool $overlay
*/
public function __construct($position = self::POSITION_RIGHT, Layout $layout = null, $overlay = false)
{

View File

@ -43,7 +43,8 @@ class PlotArea
/**
* Create a new PlotArea.
*
* @param mixed $plotSeries
* @param Layout|null $layout
* @param array $plotSeries
*/
public function __construct(Layout $layout = null, array $plotSeries = [])
{

View File

@ -44,6 +44,7 @@ class Title
* Create a new Title.
*
* @param null|mixed $caption
* @param null|Layout $layout
*/
public function __construct($caption = null, Layout $layout = null)
{

View File

@ -81,7 +81,7 @@ class HashTable
*
* @throws Exception
*/
public function add(IComparable $pSource = null)
public function add(IComparable $pSource)
{
$hash = $pSource->getHashCode();
if (!isset($this->items[$hash])) {
@ -97,7 +97,7 @@ class HashTable
*
* @throws Exception
*/
public function remove(IComparable $pSource = null)
public function remove(IComparable $pSource)
{
$hash = $pSource->getHashCode();
if (isset($this->items[$hash])) {

View File

@ -238,7 +238,7 @@ class NamedRange
*
* @return NamedRange
*/
public static function resolveRange($pNamedRange, Worksheet $pSheet = null)
public static function resolveRange($pNamedRange, Worksheet $pSheet)
{
return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
}

View File

@ -384,7 +384,7 @@ class ReferenceHelper
*
* @throws Exception
*/
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, Worksheet $pSheet = null)
public function insertNewBefore($pBefore, $pNumCols, $pNumRows, Worksheet $pSheet)
{
$remove = ($pNumCols < 0 || $pNumRows < 0);
$allCoordinates = $pSheet->getCoordinates();

View File

@ -68,7 +68,7 @@ class RichText implements IComparable
*
* @return RichText
*/
public function addText(RichText\ITextElement $pText = null)
public function addText(RichText\ITextElement $pText)
{
$this->richTextElements[] = $pText;

View File

@ -251,7 +251,7 @@ class Date
*
* @return float MS Excel serialized date/time value
*/
public static function dateTimeToExcel(\DateTimeInterface $dateValue = null)
public static function dateTimeToExcel(\DateTimeInterface $dateValue)
{
return self::formattedPHPToExcel(
$dateValue->format('Y'),

View File

@ -330,7 +330,7 @@ class Font
*
* @return int Text width in pixels (no padding added)
*/
public static function getTextWidthPixelsApprox($columnText, \PhpOffice\PhpSpreadsheet\Style\Font $font = null, $rotation = 0)
public static function getTextWidthPixelsApprox($columnText, \PhpOffice\PhpSpreadsheet\Style\Font $font, $rotation = 0)
{
$fontName = $font->getName();
$fontSize = $font->getSize();

View File

@ -256,7 +256,7 @@ class Border extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable
*
* @return Border
*/
public function setColor(Color $pValue = null)
public function setColor(Color $pValue)
{
// make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;

View File

@ -264,7 +264,7 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable
*
* @return Fill
*/
public function setStartColor(Color $pValue = null)
public function setStartColor(Color $pValue)
{
// make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
@ -298,7 +298,7 @@ class Fill extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable
*
* @return Fill
*/
public function setEndColor(Color $pValue = null)
public function setEndColor(Color $pValue)
{
// make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;

View File

@ -528,7 +528,7 @@ class Font extends Supervisor implements \PhpOffice\PhpSpreadsheet\IComparable
*
* @return Font
*/
public function setColor(Color $pValue = null)
public function setColor(Color $pValue)
{
// make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;

View File

@ -550,7 +550,7 @@ class Worksheet implements IComparable
*
* @return Chart
*/
public function addChart(Chart $pChart = null, $iChartIndex = null)
public function addChart(Chart $pChart, $iChartIndex = null)
{
$pChart->setWorksheet($this);
if (is_null($iChartIndex)) {
@ -1546,7 +1546,7 @@ class Worksheet implements IComparable
*
* @return Worksheet
*/
public function duplicateStyle(Style $pCellStyle = null, $pRange = '')
public function duplicateStyle(Style $pCellStyle, $pRange)
{
// make sure we have a real style and not supervisor
$style = $pCellStyle->getIsSupervisor() ? $pCellStyle->getSharedComponent() : $pCellStyle;
@ -1594,7 +1594,7 @@ class Worksheet implements IComparable
*
* @return Worksheet
*/
public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '')
public function duplicateConditionalStyle(array $pCellStyle, $pRange = '')
{
foreach ($pCellStyle as $cellStyle) {
if (!($cellStyle instanceof Style\Conditional)) {

View File

@ -428,7 +428,7 @@ class HeaderFooter
*
* @return HeaderFooter
*/
public function addImage(HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT)
public function addImage(HeaderFooterDrawing $image, $location = self::IMAGE_HEADER_LEFT)
{
$this->headerFooterImages[$location] = $image;

View File

@ -48,7 +48,7 @@ class Ods extends BaseWriter implements IWriter
*
* @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet
*/
public function __construct(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function __construct(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
$this->setSpreadsheet($spreadsheet);
@ -183,7 +183,7 @@ class Ods extends BaseWriter implements IWriter
*
* @return self
*/
public function setSpreadsheet(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function setSpreadsheet(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
$this->spreadSheet = $spreadsheet;

View File

@ -45,7 +45,7 @@ class Font
*
* @param \PhpOffice\PhpSpreadsheet\Style\Font $font
*/
public function __construct(\PhpOffice\PhpSpreadsheet\Style\Font $font = null)
public function __construct(\PhpOffice\PhpSpreadsheet\Style\Font $font)
{
$this->colorIndex = 0x7FFF;
$this->font = $font;

View File

@ -136,7 +136,7 @@ class Xf
*
* @param \PhpOffice\PhpSpreadsheet\Style The XF format
*/
public function __construct(\PhpOffice\PhpSpreadsheet\Style $style = null)
public function __construct(\PhpOffice\PhpSpreadsheet\Style $style)
{
$this->isStyleXf = false;
$this->fontIndex = 0;

View File

@ -111,7 +111,7 @@ class Xlsx extends BaseWriter implements IWriter
*
* @param \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet
*/
public function __construct(\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet = null)
public function __construct(\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet)
{
// Assign PhpSpreadsheet
$this->setSpreadsheet($spreadsheet);
@ -411,7 +411,7 @@ class Xlsx extends BaseWriter implements IWriter
*
* @return Xlsx
*/
public function setSpreadsheet(Spreadsheet $spreadsheet = null)
public function setSpreadsheet(Spreadsheet $spreadsheet)
{
$this->spreadSheet = $spreadsheet;

View File

@ -47,7 +47,7 @@ class Chart extends WriterPart
*
* @return string XML Output
*/
public function writeChart(\PhpOffice\PhpSpreadsheet\Chart $pChart = null, $calculateCellValues = true)
public function writeChart(\PhpOffice\PhpSpreadsheet\Chart $pChart, $calculateCellValues = true)
{
$this->calculateCellValues = $calculateCellValues;
@ -358,7 +358,7 @@ class Chart extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeDataLabels($objWriter, Layout $chartLayout = null)
private function writeDataLabels(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, Layout $chartLayout = null)
{
$objWriter->startElement('c:dLbls');

View File

@ -35,7 +35,7 @@ class Comments extends WriterPart
*
* @return string XML Output
*/
public function writeComments(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet = null)
public function writeComments(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet)
{
// Create XML writer
$objWriter = null;
@ -94,7 +94,7 @@ class Comments extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeComment(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pCellReference = 'A1', \PhpOffice\PhpSpreadsheet\Comment $pComment = null, $pAuthors = null)
private function writeComment(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, $pCellReference, \PhpOffice\PhpSpreadsheet\Comment $pComment, array $pAuthors)
{
// comment
$objWriter->startElement('comment');
@ -118,7 +118,7 @@ class Comments extends WriterPart
*
* @return string XML Output
*/
public function writeVMLComments(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet = null)
public function writeVMLComments(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet)
{
// Create XML writer
$objWriter = null;
@ -187,12 +187,12 @@ class Comments extends WriterPart
* Write VML comment to XML format.
*
* @param \PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter XML Writer
* @param string $pCellReference Cell reference
* @param string $pCellReference Cell reference, eg: 'A1'
* @param \PhpOffice\PhpSpreadsheet\Comment $pComment Comment
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeVMLComment(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pCellReference = 'A1', \PhpOffice\PhpSpreadsheet\Comment $pComment = null)
private function writeVMLComment(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, $pCellReference, \PhpOffice\PhpSpreadsheet\Comment $pComment)
{
// Metadata
list($column, $row) = \PhpOffice\PhpSpreadsheet\Cell::coordinateFromString($pCellReference);

View File

@ -36,7 +36,7 @@ class ContentTypes extends WriterPart
*
* @return string XML Output
*/
public function writeContentTypes(\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet = null, $includeCharts = false)
public function writeContentTypes(\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet, $includeCharts = false)
{
// Create XML writer
$objWriter = null;

View File

@ -35,7 +35,7 @@ class DocProps extends WriterPart
*
* @return string XML Output
*/
public function writeDocPropsApp(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function writeDocPropsApp(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Create XML writer
$objWriter = null;
@ -134,7 +134,7 @@ class DocProps extends WriterPart
*
* @return string XML Output
*/
public function writeDocPropsCore(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function writeDocPropsCore(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Create XML writer
$objWriter = null;
@ -203,7 +203,7 @@ class DocProps extends WriterPart
*
* @return string XML Output
*/
public function writeDocPropsCustom(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function writeDocPropsCustom(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
$customPropertyList = $spreadsheet->getProperties()->getCustomProperties();
if (empty($customPropertyList)) {

View File

@ -90,7 +90,7 @@ class Drawing extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
public function writeChart(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Chart $pChart = null, $pRelationId = -1)
public function writeChart(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Chart $pChart, $pRelationId = -1)
{
$tl = $pChart->getTopLeftPosition();
$tl['colRow'] = \PhpOffice\PhpSpreadsheet\Cell::coordinateFromString($tl['cell']);
@ -293,7 +293,7 @@ class Drawing extends WriterPart
*
* @return string XML Output
*/
public function writeVMLHeaderFooterImages(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet = null)
public function writeVMLHeaderFooterImages(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet)
{
// Create XML writer
$objWriter = null;
@ -442,7 +442,7 @@ class Drawing extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeVMLHeaderFooterImage(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pReference = '', \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing $pImage = null)
private function writeVMLHeaderFooterImage(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, $pReference, \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing $pImage)
{
// Calculate object id
preg_match('{(\d+)}', md5($pReference), $m);
@ -485,7 +485,7 @@ class Drawing extends WriterPart
*
* @return \PhpOffice\PhpSpreadsheet\Worksheet\Drawing[] All drawings in PhpSpreadsheet
*/
public function allDrawings(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function allDrawings(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Get an array of all drawings
$aDrawings = [];

View File

@ -35,7 +35,7 @@ class Rels extends WriterPart
*
* @return string XML Output
*/
public function writeRelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function writeRelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Create XML writer
$objWriter = null;
@ -110,7 +110,7 @@ class Rels extends WriterPart
*
* @return string XML Output
*/
public function writeWorkbookRelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function writeWorkbookRelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Create XML writer
$objWriter = null;
@ -193,7 +193,7 @@ class Rels extends WriterPart
*
* @return string XML Output
*/
public function writeWorksheetRelationships(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = false)
public function writeWorksheetRelationships(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet, $pWorksheetId = 1, $includeCharts = false)
{
// Create XML writer
$objWriter = null;
@ -353,7 +353,7 @@ class Rels extends WriterPart
*
* @return string XML Output
*/
public function writeHeaderFooterDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet = null)
public function writeHeaderFooterDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet $pWorksheet)
{
// Create XML writer
$objWriter = null;

View File

@ -35,7 +35,7 @@ class RelsRibbon extends WriterPart
*
* @return string XML Output
*/
public function writeRibbonRelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function writeRibbonRelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Create XML writer
$objWriter = null;

View File

@ -35,7 +35,7 @@ class RelsVBA extends WriterPart
*
* @return string XML Output
*/
public function writeVBARelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function writeVBARelationships(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Create XML writer
$objWriter = null;

View File

@ -85,49 +85,46 @@ class StringTable extends WriterPart
*
* @return string XML Output
*/
public function writeStringTable(array $pStringTable = null)
public function writeStringTable(array $pStringTable)
{
if ($pStringTable !== null) {
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new \PhpOffice\PhpSpreadsheet\Shared\XMLWriter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
$objWriter = new \PhpOffice\PhpSpreadsheet\Shared\XMLWriter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter::STORAGE_MEMORY);
}
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new \PhpOffice\PhpSpreadsheet\Shared\XMLWriter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
$objWriter = new \PhpOffice\PhpSpreadsheet\Shared\XMLWriter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter::STORAGE_MEMORY);
}
// XML header
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
// XML header
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
// String table
$objWriter->startElement('sst');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
$objWriter->writeAttribute('uniqueCount', count($pStringTable));
// String table
$objWriter->startElement('sst');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
$objWriter->writeAttribute('uniqueCount', count($pStringTable));
// Loop through string table
foreach ($pStringTable as $textElement) {
$objWriter->startElement('si');
// Loop through string table
foreach ($pStringTable as $textElement) {
$objWriter->startElement('si');
if (!$textElement instanceof \PhpOffice\PhpSpreadsheet\RichText) {
$textToWrite = \PhpOffice\PhpSpreadsheet\Shared\StringHelper::controlCharacterPHP2OOXML($textElement);
$objWriter->startElement('t');
if ($textToWrite !== trim($textToWrite)) {
$objWriter->writeAttribute('xml:space', 'preserve');
}
$objWriter->writeRawData($textToWrite);
$objWriter->endElement();
} elseif ($textElement instanceof \PhpOffice\PhpSpreadsheet\RichText) {
$this->writeRichText($objWriter, $textElement);
if (!$textElement instanceof \PhpOffice\PhpSpreadsheet\RichText) {
$textToWrite = \PhpOffice\PhpSpreadsheet\Shared\StringHelper::controlCharacterPHP2OOXML($textElement);
$objWriter->startElement('t');
if ($textToWrite !== trim($textToWrite)) {
$objWriter->writeAttribute('xml:space', 'preserve');
}
$objWriter->writeRawData($textToWrite);
$objWriter->endElement();
} elseif ($textElement instanceof \PhpOffice\PhpSpreadsheet\RichText) {
$this->writeRichText($objWriter, $textElement);
}
$objWriter->endElement();
return $objWriter->getData();
}
throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Invalid string table array passed.');
$objWriter->endElement();
return $objWriter->getData();
}
/**
@ -139,7 +136,7 @@ class StringTable extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
public function writeRichText(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\RichText $pRichText = null, $prefix = null)
public function writeRichText(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\RichText $pRichText, $prefix = null)
{
if ($prefix !== null) {
$prefix .= ':';
@ -224,7 +221,7 @@ class StringTable extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
public function writeRichTextForCharts(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pRichText = null, $prefix = null)
public function writeRichTextForCharts(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, $pRichText = null, $prefix = null)
{
if (!$pRichText instanceof \PhpOffice\PhpSpreadsheet\RichText) {
$textRun = $pRichText;

View File

@ -35,7 +35,7 @@ class Style extends WriterPart
*
* @return string XML Output
*/
public function writeStyles(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function writeStyles(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Create XML writer
$objWriter = null;
@ -166,7 +166,7 @@ class Style extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeFill(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\Fill $pFill = null)
private function writeFill(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Fill $pFill)
{
// Check if this is a pattern type or gradient type
if ($pFill->getFillType() === \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR ||
@ -187,7 +187,7 @@ class Style extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeGradientFill(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\Fill $pFill = null)
private function writeGradientFill(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Fill $pFill)
{
// fill
$objWriter->startElement('fill');
@ -232,7 +232,7 @@ class Style extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writePatternFill(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\Fill $pFill = null)
private function writePatternFill(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Fill $pFill)
{
// fill
$objWriter->startElement('fill');
@ -271,7 +271,7 @@ class Style extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeFont(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\Font $pFont = null)
private function writeFont(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Font $pFont)
{
// font
$objWriter->startElement('font');
@ -352,7 +352,7 @@ class Style extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeBorder(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\Borders $pBorders = null)
private function writeBorder(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Borders $pBorders)
{
// Write border
$objWriter->startElement('border');
@ -390,7 +390,7 @@ class Style extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeCellStyleXf(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style $pStyle = null, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
private function writeCellStyleXf(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style $pStyle, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// xf
$objWriter->startElement('xf');
@ -466,7 +466,7 @@ class Style extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeCellStyleDxf(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style $pStyle = null)
private function writeCellStyleDxf(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style $pStyle)
{
// dxf
$objWriter->startElement('dxf');
@ -532,7 +532,7 @@ class Style extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeBorderPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pName = 'left', \PhpOffice\PhpSpreadsheet\Style\Border $pBorder = null)
private function writeBorderPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, $pName, \PhpOffice\PhpSpreadsheet\Style\Border $pBorder)
{
// Write BorderPr
if ($pBorder->getBorderStyle() != \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_NONE) {
@ -557,7 +557,7 @@ class Style extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeNumFmt(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Style\NumberFormat $pNumberFormat = null, $pId = 0)
private function writeNumFmt(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\NumberFormat $pNumberFormat, $pId = 0)
{
// Translate formatcode
$formatCode = $pNumberFormat->getFormatCode();
@ -580,7 +580,7 @@ class Style extends WriterPart
*
* @return \PhpOffice\PhpSpreadsheet\Style[] All styles in PhpSpreadsheet
*/
public function allStyles(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function allStyles(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
return $spreadsheet->getCellXfCollection();
}
@ -594,7 +594,7 @@ class Style extends WriterPart
*
* @return \PhpOffice\PhpSpreadsheet\Style\Conditional[] All conditional styles in PhpSpreadsheet
*/
public function allConditionalStyles(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function allConditionalStyles(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Get an array of all styles
$aStyles = [];
@ -620,7 +620,7 @@ class Style extends WriterPart
*
* @return \PhpOffice\PhpSpreadsheet\Style\Fill[] All fills in PhpSpreadsheet
*/
public function allFills(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function allFills(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Get an array of unique fills
$aFills = [];
@ -654,7 +654,7 @@ class Style extends WriterPart
*
* @return \PhpOffice\PhpSpreadsheet\Style\Font[] All fonts in PhpSpreadsheet
*/
public function allFonts(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function allFonts(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Get an array of unique fonts
$aFonts = [];
@ -679,7 +679,7 @@ class Style extends WriterPart
*
* @return \PhpOffice\PhpSpreadsheet\Style\Borders[] All borders in PhpSpreadsheet
*/
public function allBorders(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function allBorders(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Get an array of unique borders
$aBorders = [];
@ -704,7 +704,7 @@ class Style extends WriterPart
*
* @return \PhpOffice\PhpSpreadsheet\Style\NumberFormat[] All number formats in PhpSpreadsheet
*/
public function allNumberFormats(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function allNumberFormats(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Get an array of unique number formats
$aNumFmts = [];

View File

@ -137,7 +137,7 @@ class Theme extends WriterPart
*
* @return string XML Output
*/
public function writeTheme(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
public function writeTheme(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Create XML writer
$objWriter = null;

View File

@ -36,7 +36,7 @@ class Workbook extends WriterPart
*
* @return string XML Output
*/
public function writeWorkbook(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null, $recalcRequired = false)
public function writeWorkbook(\PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet, $recalcRequired = false)
{
// Create XML writer
if ($this->getParentWriter()->getUseDiskCaching()) {
@ -128,7 +128,7 @@ class Workbook extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeBookViews(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
private function writeBookViews(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// bookViews
$objWriter->startElement('bookViews');
@ -159,7 +159,7 @@ class Workbook extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeWorkbookProtection(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
private function writeWorkbookProtection(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
if ($spreadsheet->getSecurity()->isSecurityEnabled()) {
$objWriter->startElement('workbookProtection');
@ -211,7 +211,7 @@ class Workbook extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeSheets(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
private function writeSheets(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Write sheets
$objWriter->startElement('sheets');
@ -266,7 +266,7 @@ class Workbook extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeDefinedNames(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet = null)
private function writeDefinedNames(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\SpreadSheet $spreadsheet)
{
// Write defined names
$objWriter->startElement('definedNames');
@ -351,7 +351,7 @@ class Workbook extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeDefinedNameForAutofilter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null, $pSheetId = 0)
private function writeDefinedNameForAutofilter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet, $pSheetId = 0)
{
// definedName for autoFilter
$autoFilterRange = $pSheet->getAutoFilter()->getRange();
@ -388,7 +388,7 @@ class Workbook extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeDefinedNameForPrintTitles(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null, $pSheetId = 0)
private function writeDefinedNameForPrintTitles(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet, $pSheetId = 0)
{
// definedName for PrintTitles
if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
@ -432,7 +432,7 @@ class Workbook extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeDefinedNameForPrintArea(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null, $pSheetId = 0)
private function writeDefinedNameForPrintArea(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet, $pSheetId = 0)
{
// definedName for PrintArea
if ($pSheet->getPageSetup()->isPrintAreaSet()) {

View File

@ -144,7 +144,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeSheetPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeSheetPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// sheetPr
$objWriter->startElement('sheetPr');
@ -192,7 +192,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeDimension(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeDimension(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// dimension
$objWriter->startElement('dimension');
@ -208,7 +208,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeSheetViews(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeSheetViews(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// sheetViews
$objWriter->startElement('sheetViews');
@ -321,7 +321,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeSheetFormatPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeSheetFormatPr(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// sheetFormatPr
$objWriter->startElement('sheetFormatPr');
@ -374,7 +374,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeCols(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeCols(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// cols
if (count($pSheet->getColumnDimensions()) > 0) {
@ -440,7 +440,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeSheetProtection(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeSheetProtection(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// sheetProtection
$objWriter->startElement('sheetProtection');
@ -476,7 +476,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeConditionalFormatting(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeConditionalFormatting(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// Conditional id
$id = 1;
@ -550,7 +550,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeDataValidations(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeDataValidations(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// Datavalidation collection
$dataValidationCollection = $pSheet->getDataValidationCollection();
@ -617,7 +617,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeHyperlinks(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeHyperlinks(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// Hyperlink collection
$hyperlinkCollection = $pSheet->getHyperlinkCollection();
@ -659,7 +659,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeProtectedRanges(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeProtectedRanges(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
if (count($pSheet->getProtectedCells()) > 0) {
// protectedRanges
@ -689,7 +689,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeMergeCells(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeMergeCells(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
if (count($pSheet->getMergeCells()) > 0) {
// mergeCells
@ -715,7 +715,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writePrintOptions(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writePrintOptions(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// printOptions
$objWriter->startElement('printOptions');
@ -742,7 +742,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writePageMargins(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writePageMargins(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// pageMargins
$objWriter->startElement('pageMargins');
@ -763,7 +763,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeAutoFilter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeAutoFilter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
$autoFilterRange = $pSheet->getAutoFilter()->getRange();
if (!empty($autoFilterRange)) {
@ -857,7 +857,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writePageSetup(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writePageSetup(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// pageSetup
$objWriter->startElement('pageSetup');
@ -893,7 +893,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeHeaderFooter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeHeaderFooter(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// headerFooter
$objWriter->startElement('headerFooter');
@ -919,7 +919,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeBreaks(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeBreaks(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// Get row and column breaks
$aRowBreaks = [];
@ -1201,7 +1201,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeLegacyDrawing(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeLegacyDrawing(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// If sheet contains comments, add the relationships
if (count($pSheet->getComments()) > 0) {
@ -1219,7 +1219,7 @@ class Worksheet extends WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private function writeLegacyDrawingHF(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet = null)
private function writeLegacyDrawingHF(\PhpOffice\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet $pSheet)
{
// If sheet contains images, add the relationships
if (count($pSheet->getHeaderFooter()->getImages()) > 0) {

View File

@ -40,7 +40,7 @@ abstract class WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
public function setParentWriter(\PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter = null)
public function setParentWriter(\PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter)
{
$this->parentWriter = $pWriter;
}
@ -67,10 +67,8 @@ abstract class WriterPart
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
public function __construct(\PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter = null)
public function __construct(\PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter)
{
if (!is_null($pWriter)) {
$this->parentWriter = $pWriter;
}
$this->parentWriter = $pWriter;
}
}

View File

@ -38,9 +38,7 @@ class ContentTest extends \PHPUnit_Framework_TestCase
public function testWriteEmptySpreadsheet()
{
$content = new Content();
$content->setParentWriter(new Ods(new Spreadsheet()));
$content = new Content(new Ods(new Spreadsheet()));
$xml = $content->write();
$this->assertXmlStringEqualsXmlFile($this->samplesPath . '/content-empty.xml', $xml);
@ -91,9 +89,7 @@ class ContentTest extends \PHPUnit_Framework_TestCase
$worksheet2->setCellValue('A1', 2);
// Write
$content = new Content();
$content->setParentWriter(new Ods($workbook));
$content = new Content(new Ods($workbook));
$xml = $content->write();
$this->assertXmlStringEqualsXmlFile($this->samplesPath . '/content-with-data.xml', $xml);