Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
1 / 1 |
| Comment | |
100.00% |
9 / 9 |
|
100.00% |
6 / 6 |
6 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getInitials | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setStartElement | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getStartElement | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setEndElement | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getEndElement | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is part of PHPWord - A pure PHP library for reading and writing |
| 5 | * word processing documents. |
| 6 | * |
| 7 | * PHPWord is free software distributed under the terms of the GNU Lesser |
| 8 | * General Public License version 3 as published by the Free Software Foundation. |
| 9 | * |
| 10 | * For the full copyright and license information, please read the LICENSE |
| 11 | * file that was distributed with this source code. For the full list of |
| 12 | * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. |
| 13 | * |
| 14 | * @see https://github.com/PHPOffice/PHPWord |
| 15 | * |
| 16 | * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 |
| 17 | */ |
| 18 | |
| 19 | namespace PhpOffice\PhpWord\Element; |
| 20 | |
| 21 | use DateTime; |
| 22 | |
| 23 | /** |
| 24 | * Comment element. |
| 25 | * |
| 26 | * @see http://datypic.com/sc/ooxml/t-w_CT_Comment.html |
| 27 | */ |
| 28 | class Comment extends TrackChange |
| 29 | { |
| 30 | /** |
| 31 | * Initials. |
| 32 | * |
| 33 | * @var string |
| 34 | */ |
| 35 | private $initials; |
| 36 | |
| 37 | /** |
| 38 | * The Element where this comment starts. |
| 39 | * |
| 40 | * @var AbstractElement |
| 41 | */ |
| 42 | private $startElement; |
| 43 | |
| 44 | /** |
| 45 | * The Element where this comment ends. |
| 46 | * |
| 47 | * @var AbstractElement |
| 48 | */ |
| 49 | private $endElement; |
| 50 | |
| 51 | /** |
| 52 | * Is part of collection. |
| 53 | * |
| 54 | * @var bool |
| 55 | */ |
| 56 | protected $collectionRelation = true; |
| 57 | |
| 58 | /** |
| 59 | * Create a new Comment Element. |
| 60 | * |
| 61 | * @param string $author |
| 62 | * @param null|DateTime $date |
| 63 | * @param string $initials |
| 64 | */ |
| 65 | public function __construct($author, $date = null, $initials = null) |
| 66 | { |
| 67 | parent::__construct(null, $author, $date); |
| 68 | $this->initials = $initials; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Get Initials. |
| 73 | * |
| 74 | * @return string |
| 75 | */ |
| 76 | public function getInitials() |
| 77 | { |
| 78 | return $this->initials; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Sets the element where this comment starts. |
| 83 | */ |
| 84 | public function setStartElement(AbstractElement $value): void |
| 85 | { |
| 86 | $this->startElement = $value; |
| 87 | $value->setCommentRangeStart($this); |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Get the element where this comment starts. |
| 92 | * |
| 93 | * @return AbstractElement |
| 94 | */ |
| 95 | public function getStartElement() |
| 96 | { |
| 97 | return $this->startElement; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Sets the element where this comment ends. |
| 102 | */ |
| 103 | public function setEndElement(AbstractElement $value): void |
| 104 | { |
| 105 | $this->endElement = $value; |
| 106 | $value->setCommentRangeEnd($this); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Get the element where this comment ends. |
| 111 | * |
| 112 | * @return AbstractElement |
| 113 | */ |
| 114 | public function getEndElement() |
| 115 | { |
| 116 | return $this->endElement; |
| 117 | } |
| 118 | } |