Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
14 / 14 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
| Shading | |
100.00% |
14 / 14 |
|
100.00% |
7 / 7 |
7 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPattern | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setPattern | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
| getColor | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setColor | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getFill | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setFill | |
100.00% |
2 / 2 |
|
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\Style; |
| 20 | |
| 21 | /** |
| 22 | * Shading style. |
| 23 | * |
| 24 | * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Shd.html |
| 25 | * @since 0.10.0 |
| 26 | */ |
| 27 | class Shading extends AbstractStyle |
| 28 | { |
| 29 | /** |
| 30 | * Pattern constants (partly). |
| 31 | * |
| 32 | * @const string |
| 33 | * |
| 34 | * @see http://www.schemacentral.com/sc/ooxml/t-w_ST_Shd.html |
| 35 | */ |
| 36 | const PATTERN_CLEAR = 'clear'; // No pattern |
| 37 | const PATTERN_SOLID = 'solid'; // 100% fill pattern |
| 38 | const PATTERN_HSTRIPE = 'horzStripe'; // Horizontal stripe pattern |
| 39 | const PATTERN_VSTRIPE = 'vertStripe'; // Vertical stripe pattern |
| 40 | const PATTERN_DSTRIPE = 'diagStripe'; // Diagonal stripe pattern |
| 41 | const PATTERN_HCROSS = 'horzCross'; // Horizontal cross pattern |
| 42 | const PATTERN_DCROSS = 'diagCross'; // Diagonal cross pattern |
| 43 | |
| 44 | /** |
| 45 | * Shading pattern. |
| 46 | * |
| 47 | * @var string |
| 48 | * |
| 49 | * @see http://www.schemacentral.com/sc/ooxml/t-w_ST_Shd.html |
| 50 | */ |
| 51 | private $pattern = self::PATTERN_CLEAR; |
| 52 | |
| 53 | /** |
| 54 | * Shading pattern color. |
| 55 | * |
| 56 | * @var string |
| 57 | */ |
| 58 | private $color; |
| 59 | |
| 60 | /** |
| 61 | * Shading background color. |
| 62 | * |
| 63 | * @var string |
| 64 | */ |
| 65 | private $fill; |
| 66 | |
| 67 | /** |
| 68 | * Create a new instance. |
| 69 | * |
| 70 | * @param array $style |
| 71 | */ |
| 72 | public function __construct($style = []) |
| 73 | { |
| 74 | $this->setStyleByArray($style); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Get pattern. |
| 79 | * |
| 80 | * @return string |
| 81 | */ |
| 82 | public function getPattern() |
| 83 | { |
| 84 | return $this->pattern; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Set pattern. |
| 89 | * |
| 90 | * @param string $value |
| 91 | * |
| 92 | * @return self |
| 93 | */ |
| 94 | public function setPattern($value = null) |
| 95 | { |
| 96 | $enum = [ |
| 97 | self::PATTERN_CLEAR, self::PATTERN_SOLID, self::PATTERN_HSTRIPE, |
| 98 | self::PATTERN_VSTRIPE, self::PATTERN_DSTRIPE, self::PATTERN_HCROSS, self::PATTERN_DCROSS, |
| 99 | ]; |
| 100 | $this->pattern = $this->setEnumVal($value, $enum, $this->pattern); |
| 101 | |
| 102 | return $this; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Get color. |
| 107 | * |
| 108 | * @return string |
| 109 | */ |
| 110 | public function getColor() |
| 111 | { |
| 112 | return $this->color; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Set pattern. |
| 117 | * |
| 118 | * @param string $value |
| 119 | * |
| 120 | * @return self |
| 121 | */ |
| 122 | public function setColor($value = null) |
| 123 | { |
| 124 | $this->color = $value; |
| 125 | |
| 126 | return $this; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Get fill. |
| 131 | * |
| 132 | * @return string |
| 133 | */ |
| 134 | public function getFill() |
| 135 | { |
| 136 | return $this->fill; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * Set fill. |
| 141 | * |
| 142 | * @param string $value |
| 143 | * |
| 144 | * @return self |
| 145 | */ |
| 146 | public function setFill($value = null) |
| 147 | { |
| 148 | $this->fill = $value; |
| 149 | |
| 150 | return $this; |
| 151 | } |
| 152 | } |