diff --git a/src/PhpSpreadsheet/Writer/Ods/WriterPart.php b/src/PhpSpreadsheet/Writer/Ods/WriterPart.php index dee7532c..b07b38cb 100644 --- a/src/PhpSpreadsheet/Writer/Ods/WriterPart.php +++ b/src/PhpSpreadsheet/Writer/Ods/WriterPart.php @@ -24,6 +24,34 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Ods; * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -abstract class WriterPart extends \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart +abstract class WriterPart { + /** + * Parent Ods object. + * + * @var \PhpOffice\PhpSpreadsheet\Writer\Ods + */ + private $parentWriter; + + /** + * Get Ods writer. + * + * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * + * @return \PhpOffice\PhpSpreadsheet\Writer\Ods + */ + public function getParentWriter() + { + return $this->parentWriter; + } + + /** + * Set parent Ods writer. + * + * @param \PhpOffice\PhpSpreadsheet\Writer\Ods $writer + */ + public function __construct(\PhpOffice\PhpSpreadsheet\Writer\Ods $writer) + { + $this->parentWriter = $writer; + } } diff --git a/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php b/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php index 881683db..a743ab12 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php @@ -27,47 +27,30 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; abstract class WriterPart { /** - * Parent IWriter object. + * Parent Xlsx object. * - * @var \PhpOffice\PhpSpreadsheet\Writer\IWriter + * @var \PhpOffice\PhpSpreadsheet\Writer\Xlsx */ private $parentWriter; /** - * Set parent IWriter object. - * - * @param \PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter - * - * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception - */ - public function setParentWriter(\PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter) - { - $this->parentWriter = $pWriter; - } - - /** - * Get parent IWriter object. + * Get parent Xlsx object. * * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception * - * @return \PhpOffice\PhpSpreadsheet\Writer\IWriter + * @return \PhpOffice\PhpSpreadsheet\Writer\Xlsx */ public function getParentWriter() { - if (!is_null($this->parentWriter)) { - return $this->parentWriter; - } - throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('No parent \\PhpOffice\\PhpSpreadsheet\\Writer\\IWriter assigned.'); + return $this->parentWriter; } /** - * Set parent IWriter object. + * Set parent Xlsx object. * - * @param \PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter - * - * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * @param \PhpOffice\PhpSpreadsheet\Writer\Xlsx $pWriter */ - public function __construct(\PhpOffice\PhpSpreadsheet\Writer\IWriter $pWriter) + public function __construct(\PhpOffice\PhpSpreadsheet\Writer\Xlsx $pWriter) { $this->parentWriter = $pWriter; }