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
*/
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);
}
/**

View File

@ -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);
}
}

View File

@ -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();