make Comment constructor attributes optional
This commit is contained in:
parent
0f50b6dc61
commit
601a2b6ec6
|
|
@ -21,7 +21,7 @@ $textrun->addText(' a test');
|
|||
$section->addTextBreak(2);
|
||||
|
||||
// Let's create a comment that we will link to a start element and an end element
|
||||
$commentWithStartAndEnd = new \PhpOffice\PhpWord\Element\Comment('Foo Bar', new \DateTime(), '');
|
||||
$commentWithStartAndEnd = new \PhpOffice\PhpWord\Element\Comment('Foo Bar', new \DateTime());
|
||||
$commentWithStartAndEnd->addText('A comment with a start and an end');
|
||||
$phpWord->addComment($commentWithStartAndEnd);
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ $textToEndOn->setCommentRangeEnd($commentWithStartAndEnd);
|
|||
$section->addTextBreak(2);
|
||||
|
||||
// Let's add a comment on an image
|
||||
$commentOnImage = new \PhpOffice\PhpWord\Element\Comment('Mr Smart', new \DateTime(), '');
|
||||
$commentOnImage = new \PhpOffice\PhpWord\Element\Comment('Mr Smart', new \DateTime());
|
||||
$imageComment = $commentOnImage->addTextRun();
|
||||
$imageComment->addText('Hey, Mars does look ');
|
||||
$imageComment->addText('red', array('color' => 'FF0000'));
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Comment extends TrackChange
|
|||
* @param \DateTime $date
|
||||
* @param string $initials
|
||||
*/
|
||||
public function __construct($author, $date, $initials)
|
||||
public function __construct($author, $date = null, $initials = null)
|
||||
{
|
||||
parent::__construct($author, $date);
|
||||
$this->initials = $initials;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class TrackChange extends AbstractContainer
|
|||
* @param string $author
|
||||
* @param \DateTime $date
|
||||
*/
|
||||
public function __construct($author, \DateTime $date)
|
||||
public function __construct($author, \DateTime $date = null)
|
||||
{
|
||||
$this->author = $author;
|
||||
$this->date = $date;
|
||||
|
|
|
|||
Loading…
Reference in New Issue