From 68dd3fd576de0d7eafb50176d2db4d199fa03628 Mon Sep 17 00:00:00 2001 From: antoine Date: Wed, 24 May 2017 00:18:17 +0200 Subject: [PATCH] rename attribute to match generated XML node name --- src/PhpWord/Element/AbstractElement.php | 24 +++++++++---------- src/PhpWord/Element/Comment.php | 8 +++---- .../Word2007/Element/AbstractElement.php | 12 +++++----- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index b84211b9..8ff64194 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -119,14 +119,14 @@ abstract class AbstractElement * * @var Comment */ - protected $commentStart; + protected $commentRangeStart; /** * The end position for the linked comment * * @var Comment */ - protected $commentEnd; + protected $commentRangeEnd; /** * Get PhpWord @@ -284,9 +284,9 @@ abstract class AbstractElement * * @return Comment */ - public function getCommentStart() + public function getCommentRangeStart() { - return $this->commentStart; + return $this->commentRangeStart; } /** @@ -294,13 +294,13 @@ abstract class AbstractElement * * @param Comment $value */ - public function setCommentStart(Comment $value) + public function setCommentRangeStart(Comment $value) { if ($this instanceof Comment) { throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); } - $this->commentStart = $value; - $this->commentStart->setStartElement($this); + $this->commentRangeStart= $value; + $this->commentRangeStart->setStartElement($this); } /** @@ -308,9 +308,9 @@ abstract class AbstractElement * * @return Comment */ - public function getCommentEnd() + public function getCommentRangeEnd() { - return $this->commentEnd; + return $this->commentRangeEnd; } /** @@ -319,13 +319,13 @@ abstract class AbstractElement * @param Comment $value * @return void */ - public function setCommentEnd(Comment $value) + public function setCommentRangeEnd(Comment $value) { if ($this instanceof Comment) { throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); } - $this->commentEnd = $value; - $this->commentEnd->setEndElement($this); + $this->commentRangeEnd= $value; + $this->commentRangeEnd->setEndElement($this); } /** diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index df2e4d4d..def9d5a8 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -82,8 +82,8 @@ class Comment extends TrackChange public function setStartElement(AbstractElement $value) { $this->startElement = $value; - if ($value->getCommentStart() == null) { - $value->setCommentStart($this); + if ($value->getCommentRangeStart() == null) { + $value->setCommentRangeStart($this); } } @@ -105,8 +105,8 @@ class Comment extends TrackChange public function setEndElement(AbstractElement $value) { $this->endElement = $value; - if ($value->getCommentEnd() == null) { - $value->setCommentEnd($this); + if ($value->getCommentRangeEnd() == null) { + $value->setCommentRangeEnd($this); } } diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 474d40ce..79877b10 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -126,8 +126,8 @@ abstract class AbstractElement */ protected function writeCommentRangeStart() { - if ($this->element->getCommentStart() != null) { - $comment = $this->element->getCommentStart(); + if ($this->element->getCommentRangeStart() != null) { + $comment = $this->element->getCommentRangeStart(); //only set the ID if it is not yet set, otherwise it will overwrite it if ($comment->getElementId() == null) { $comment->setElementId(); @@ -145,8 +145,8 @@ abstract class AbstractElement */ protected function writeCommentRangeEnd() { - if ($this->element->getCommentEnd() != null) { - $comment = $this->element->getCommentEnd(); + if ($this->element->getCommentRangeEnd() != null) { + $comment = $this->element->getCommentRangeEnd(); //only set the ID if it is not yet set, otherwise it will overwrite it if ($comment->getElementId() == null) { $comment->setElementId(); @@ -156,8 +156,8 @@ abstract class AbstractElement $this->xmlWriter->startElement('w:r'); $this->xmlWriter->writeElementBlock('w:commentReference', array('w:id' => $comment->getElementId())); $this->xmlWriter->endElement(); - } elseif ($this->element->getCommentStart() != null && $this->element->getCommentStart()->getEndElement() == null) { - $comment = $this->element->getCommentStart(); + } elseif ($this->element->getCommentRangeStart() != null && $this->element->getCommentRangeStart()->getEndElement() == null) { + $comment = $this->element->getCommentRangeStart(); //only set the ID if it is not yet set, otherwise it will overwrite it if ($comment->getElementId() == null) { $comment->setElementId();