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