Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
10 / 10 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
ProofState | |
100.00% |
10 / 10 |
|
100.00% |
4 / 4 |
8 | |
100.00% |
1 / 1 |
setSpelling | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
3 | |||
getSpelling | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setGrammar | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
3 | |||
getGrammar | |
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\ComplexType; |
20 | |
21 | use InvalidArgumentException; |
22 | |
23 | /** |
24 | * Spelling and Grammatical Checking State. |
25 | * |
26 | * @see http://www.datypic.com/sc/ooxml/e-w_proofState-1.html |
27 | */ |
28 | final class ProofState |
29 | { |
30 | /** |
31 | * Check Completed. |
32 | */ |
33 | const CLEAN = 'clean'; |
34 | |
35 | /** |
36 | * Check Not Completed. |
37 | */ |
38 | const DIRTY = 'dirty'; |
39 | |
40 | /** |
41 | * Spell Checking State. |
42 | * |
43 | * @var string |
44 | */ |
45 | private $spelling; |
46 | |
47 | /** |
48 | * Grammatical Checking State. |
49 | * |
50 | * @var string |
51 | */ |
52 | private $grammar; |
53 | |
54 | /** |
55 | * Set the Spell Checking State (dirty or clean). |
56 | * |
57 | * @param string $spelling |
58 | * |
59 | * @return self |
60 | */ |
61 | public function setSpelling($spelling) |
62 | { |
63 | if ($spelling == self::CLEAN || $spelling == self::DIRTY) { |
64 | $this->spelling = $spelling; |
65 | } else { |
66 | throw new InvalidArgumentException('Invalid value, dirty or clean possible'); |
67 | } |
68 | |
69 | return $this; |
70 | } |
71 | |
72 | /** |
73 | * Get the Spell Checking State. |
74 | * |
75 | * @return string |
76 | */ |
77 | public function getSpelling() |
78 | { |
79 | return $this->spelling; |
80 | } |
81 | |
82 | /** |
83 | * Set the Grammatical Checking State (dirty or clean). |
84 | * |
85 | * @param string $grammar |
86 | * |
87 | * @return self |
88 | */ |
89 | public function setGrammar($grammar) |
90 | { |
91 | if ($grammar == self::CLEAN || $grammar == self::DIRTY) { |
92 | $this->grammar = $grammar; |
93 | } else { |
94 | throw new InvalidArgumentException('Invalid value, dirty or clean possible'); |
95 | } |
96 | |
97 | return $this; |
98 | } |
99 | |
100 | /** |
101 | * Get the Grammatical Checking State. |
102 | * |
103 | * @return string |
104 | */ |
105 | public function getGrammar() |
106 | { |
107 | return $this->grammar; |
108 | } |
109 | } |