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