Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
7 / 7 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
TrackChange | |
100.00% |
7 / 7 |
|
100.00% |
4 / 4 |
7 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
4 | |||
getAuthor | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getDate | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getChangeType | |
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 | * TrackChange element. |
25 | * |
26 | * @see http://datypic.com/sc/ooxml/t-w_CT_TrackChange.html |
27 | * @see http://datypic.com/sc/ooxml/t-w_CT_RunTrackChange.html |
28 | */ |
29 | class TrackChange extends AbstractContainer |
30 | { |
31 | const INSERTED = 'INSERTED'; |
32 | const DELETED = 'DELETED'; |
33 | |
34 | /** |
35 | * @var string Container type |
36 | */ |
37 | protected $container = 'TrackChange'; |
38 | |
39 | /** |
40 | * The type of change, (insert or delete), not applicable for PhpOffice\PhpWord\Element\Comment. |
41 | * |
42 | * @var string |
43 | */ |
44 | private $changeType; |
45 | |
46 | /** |
47 | * Author. |
48 | * |
49 | * @var string |
50 | */ |
51 | private $author; |
52 | |
53 | /** |
54 | * Date. |
55 | * |
56 | * @var DateTime |
57 | */ |
58 | private $date; |
59 | |
60 | /** |
61 | * Create a new TrackChange Element. |
62 | * |
63 | * @param string $changeType |
64 | * @param string $author |
65 | * @param null|bool|DateTime|int $date |
66 | */ |
67 | public function __construct($changeType = null, $author = null, $date = null) |
68 | { |
69 | $this->changeType = $changeType; |
70 | $this->author = $author; |
71 | if ($date !== null && $date !== false) { |
72 | $this->date = ($date instanceof DateTime) ? $date : new DateTime('@' . $date); |
73 | } |
74 | } |
75 | |
76 | /** |
77 | * Get TrackChange Author. |
78 | * |
79 | * @return string |
80 | */ |
81 | public function getAuthor() |
82 | { |
83 | return $this->author; |
84 | } |
85 | |
86 | /** |
87 | * Get TrackChange Date. |
88 | * |
89 | * @return DateTime |
90 | */ |
91 | public function getDate() |
92 | { |
93 | return $this->date; |
94 | } |
95 | |
96 | /** |
97 | * Get the Change type. |
98 | * |
99 | * @return string |
100 | */ |
101 | public function getChangeType() |
102 | { |
103 | return $this->changeType; |
104 | } |
105 | } |