rename attribute to match generated XML node name

This commit is contained in:
antoine 2017-05-24 00:18:17 +02:00
parent 11c711b275
commit 68dd3fd576
3 changed files with 22 additions and 22 deletions

View File

@ -119,14 +119,14 @@ abstract class AbstractElement
* *
* @var Comment * @var Comment
*/ */
protected $commentStart; protected $commentRangeStart;
/** /**
* The end position for the linked comment * The end position for the linked comment
* *
* @var Comment * @var Comment
*/ */
protected $commentEnd; protected $commentRangeEnd;
/** /**
* Get PhpWord * Get PhpWord
@ -284,9 +284,9 @@ abstract class AbstractElement
* *
* @return Comment * @return Comment
*/ */
public function getCommentStart() public function getCommentRangeStart()
{ {
return $this->commentStart; return $this->commentRangeStart;
} }
/** /**
@ -294,13 +294,13 @@ abstract class AbstractElement
* *
* @param Comment $value * @param Comment $value
*/ */
public function setCommentStart(Comment $value) public function setCommentRangeStart(Comment $value)
{ {
if ($this instanceof Comment) { if ($this instanceof Comment) {
throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); throw new \InvalidArgumentException("Cannot set a Comment on a Comment");
} }
$this->commentStart = $value; $this->commentRangeStart= $value;
$this->commentStart->setStartElement($this); $this->commentRangeStart->setStartElement($this);
} }
/** /**
@ -308,9 +308,9 @@ abstract class AbstractElement
* *
* @return Comment * @return Comment
*/ */
public function getCommentEnd() public function getCommentRangeEnd()
{ {
return $this->commentEnd; return $this->commentRangeEnd;
} }
/** /**
@ -319,13 +319,13 @@ abstract class AbstractElement
* @param Comment $value * @param Comment $value
* @return void * @return void
*/ */
public function setCommentEnd(Comment $value) public function setCommentRangeEnd(Comment $value)
{ {
if ($this instanceof Comment) { if ($this instanceof Comment) {
throw new \InvalidArgumentException("Cannot set a Comment on a Comment"); throw new \InvalidArgumentException("Cannot set a Comment on a Comment");
} }
$this->commentEnd = $value; $this->commentRangeEnd= $value;
$this->commentEnd->setEndElement($this); $this->commentRangeEnd->setEndElement($this);
} }
/** /**

View File

@ -82,8 +82,8 @@ class Comment extends TrackChange
public function setStartElement(AbstractElement $value) public function setStartElement(AbstractElement $value)
{ {
$this->startElement = $value; $this->startElement = $value;
if ($value->getCommentStart() == null) { if ($value->getCommentRangeStart() == null) {
$value->setCommentStart($this); $value->setCommentRangeStart($this);
} }
} }
@ -105,8 +105,8 @@ class Comment extends TrackChange
public function setEndElement(AbstractElement $value) public function setEndElement(AbstractElement $value)
{ {
$this->endElement = $value; $this->endElement = $value;
if ($value->getCommentEnd() == null) { if ($value->getCommentRangeEnd() == null) {
$value->setCommentEnd($this); $value->setCommentRangeEnd($this);
} }
} }

View File

@ -126,8 +126,8 @@ abstract class AbstractElement
*/ */
protected function writeCommentRangeStart() protected function writeCommentRangeStart()
{ {
if ($this->element->getCommentStart() != null) { if ($this->element->getCommentRangeStart() != null) {
$comment = $this->element->getCommentStart(); $comment = $this->element->getCommentRangeStart();
//only set the ID if it is not yet set, otherwise it will overwrite it //only set the ID if it is not yet set, otherwise it will overwrite it
if ($comment->getElementId() == null) { if ($comment->getElementId() == null) {
$comment->setElementId(); $comment->setElementId();
@ -145,8 +145,8 @@ abstract class AbstractElement
*/ */
protected function writeCommentRangeEnd() protected function writeCommentRangeEnd()
{ {
if ($this->element->getCommentEnd() != null) { if ($this->element->getCommentRangeEnd() != null) {
$comment = $this->element->getCommentEnd(); $comment = $this->element->getCommentRangeEnd();
//only set the ID if it is not yet set, otherwise it will overwrite it //only set the ID if it is not yet set, otherwise it will overwrite it
if ($comment->getElementId() == null) { if ($comment->getElementId() == null) {
$comment->setElementId(); $comment->setElementId();
@ -156,8 +156,8 @@ abstract class AbstractElement
$this->xmlWriter->startElement('w:r'); $this->xmlWriter->startElement('w:r');
$this->xmlWriter->writeElementBlock('w:commentReference', array('w:id' => $comment->getElementId())); $this->xmlWriter->writeElementBlock('w:commentReference', array('w:id' => $comment->getElementId()));
$this->xmlWriter->endElement(); $this->xmlWriter->endElement();
} elseif ($this->element->getCommentStart() != null && $this->element->getCommentStart()->getEndElement() == null) { } elseif ($this->element->getCommentRangeStart() != null && $this->element->getCommentRangeStart()->getEndElement() == null) {
$comment = $this->element->getCommentStart(); $comment = $this->element->getCommentRangeStart();
//only set the ID if it is not yet set, otherwise it will overwrite it //only set the ID if it is not yet set, otherwise it will overwrite it
if ($comment->getElementId() == null) { if ($comment->getElementId() == null) {
$comment->setElementId(); $comment->setElementId();