Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
30 / 30 |
|
100.00% |
16 / 16 |
CRAP | |
100.00% |
1 / 1 |
| Outline | |
100.00% |
30 / 30 |
|
100.00% |
16 / 16 |
16 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUnit | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getWeight | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setWeight | |
100.00% |
2 / 2 |
|
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 | |||
| getDash | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setDash | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getLine | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setLine | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| getEndCap | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setEndCap | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| getStartArrow | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setStartArrow | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| getEndArrow | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setEndArrow | |
100.00% |
4 / 4 |
|
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 | * Outline defines the line/border of the object. |
| 23 | * |
| 24 | * @see http://www.schemacentral.com/sc/ooxml/t-v_CT_Stroke.html |
| 25 | * @see http://www.w3.org/TR/1998/NOTE-VML-19980513#_Toc416858395 |
| 26 | * @since 0.12.0 |
| 27 | */ |
| 28 | class Outline extends AbstractStyle |
| 29 | { |
| 30 | /** |
| 31 | * Line style constants. |
| 32 | * |
| 33 | * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeLineStyle.html |
| 34 | * |
| 35 | * @const string |
| 36 | */ |
| 37 | const LINE_SINGLE = 'single'; |
| 38 | const LINE_THIN_THIN = 'thinThin'; |
| 39 | const LINE_THIN_THICK = 'thinThick'; |
| 40 | const LINE_THICK_THIN = 'thickThin'; |
| 41 | const LINE_THICK_BETWEEN_THIN = 'thickBetweenThin'; |
| 42 | |
| 43 | /** |
| 44 | * Line style constants. |
| 45 | * |
| 46 | * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html |
| 47 | * |
| 48 | * @const string |
| 49 | */ |
| 50 | const ENDCAP_FLAT = 'flat'; |
| 51 | const ENDCAP_SQUARE = 'square'; |
| 52 | const ENDCAP_ROUND = 'round'; |
| 53 | |
| 54 | /** |
| 55 | * Arrowhead type constants. |
| 56 | * |
| 57 | * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeArrowType.html |
| 58 | * |
| 59 | * @const string |
| 60 | */ |
| 61 | const ARROW_NONE = 'none'; |
| 62 | const ARROW_BLOCK = 'block'; |
| 63 | const ARROW_CLASSIC = 'classic'; |
| 64 | const ARROW_OVAL = 'oval'; |
| 65 | const ARROW_DIAMOND = 'diamond'; |
| 66 | const ARROW_OPEN = 'open'; |
| 67 | |
| 68 | /** |
| 69 | * Unit; No set method for now. |
| 70 | * |
| 71 | * @var string |
| 72 | */ |
| 73 | private $unit = 'pt'; |
| 74 | |
| 75 | /** |
| 76 | * Outline weight. |
| 77 | * |
| 78 | * @var float|int |
| 79 | */ |
| 80 | private $weight; |
| 81 | |
| 82 | /** |
| 83 | * Outline color. |
| 84 | * |
| 85 | * @var string |
| 86 | */ |
| 87 | private $color; |
| 88 | |
| 89 | /** |
| 90 | * Dash type. |
| 91 | * |
| 92 | * @var string |
| 93 | */ |
| 94 | private $dash; |
| 95 | |
| 96 | /** |
| 97 | * Line style. |
| 98 | * |
| 99 | * @var string |
| 100 | */ |
| 101 | private $line; |
| 102 | |
| 103 | /** |
| 104 | * End cap. |
| 105 | * |
| 106 | * @var string |
| 107 | * |
| 108 | * @see http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html |
| 109 | */ |
| 110 | private $endCap; |
| 111 | |
| 112 | /** |
| 113 | * Start arrow type. |
| 114 | * |
| 115 | * @var string |
| 116 | */ |
| 117 | private $startArrow; |
| 118 | |
| 119 | /** |
| 120 | * End arrow type. |
| 121 | * |
| 122 | * @var string |
| 123 | */ |
| 124 | private $endArrow; |
| 125 | |
| 126 | /** |
| 127 | * Create a new instance. |
| 128 | * |
| 129 | * @param array $style |
| 130 | */ |
| 131 | public function __construct($style = []) |
| 132 | { |
| 133 | $this->setStyleByArray($style); |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Get unit. |
| 138 | * |
| 139 | * @return string |
| 140 | */ |
| 141 | public function getUnit() |
| 142 | { |
| 143 | return $this->unit; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * Get weight. |
| 148 | * |
| 149 | * @return float|int |
| 150 | */ |
| 151 | public function getWeight() |
| 152 | { |
| 153 | return $this->weight; |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Set weight. |
| 158 | * |
| 159 | * @param float|int $value |
| 160 | * |
| 161 | * @return self |
| 162 | */ |
| 163 | public function setWeight($value = null) |
| 164 | { |
| 165 | $this->weight = $this->setNumericVal($value, null); |
| 166 | |
| 167 | return $this; |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * Get color. |
| 172 | * |
| 173 | * @return string |
| 174 | */ |
| 175 | public function getColor() |
| 176 | { |
| 177 | return $this->color; |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * Set color. |
| 182 | * |
| 183 | * @param string $value |
| 184 | * |
| 185 | * @return self |
| 186 | */ |
| 187 | public function setColor($value = null) |
| 188 | { |
| 189 | $this->color = $value; |
| 190 | |
| 191 | return $this; |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * Get dash type. |
| 196 | * |
| 197 | * @return string |
| 198 | */ |
| 199 | public function getDash() |
| 200 | { |
| 201 | return $this->dash; |
| 202 | } |
| 203 | |
| 204 | /** |
| 205 | * Set dash type. |
| 206 | * |
| 207 | * @param string $value |
| 208 | * |
| 209 | * @return self |
| 210 | */ |
| 211 | public function setDash($value = null) |
| 212 | { |
| 213 | $this->dash = $value; |
| 214 | |
| 215 | return $this; |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Get line style. |
| 220 | * |
| 221 | * @return string |
| 222 | */ |
| 223 | public function getLine() |
| 224 | { |
| 225 | return $this->line; |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * Set line style. |
| 230 | * |
| 231 | * @param string $value |
| 232 | * |
| 233 | * @return self |
| 234 | */ |
| 235 | public function setLine($value = null) |
| 236 | { |
| 237 | $enum = [self::LINE_SINGLE, self::LINE_THIN_THIN, self::LINE_THIN_THICK, |
| 238 | self::LINE_THICK_THIN, self::LINE_THICK_BETWEEN_THIN, ]; |
| 239 | $this->line = $this->setEnumVal($value, $enum, null); |
| 240 | |
| 241 | return $this; |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Get endCap style. |
| 246 | * |
| 247 | * @return string |
| 248 | */ |
| 249 | public function getEndCap() |
| 250 | { |
| 251 | return $this->endCap; |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * Set endCap style. |
| 256 | * |
| 257 | * @param string $value |
| 258 | * |
| 259 | * @return self |
| 260 | */ |
| 261 | public function setEndCap($value = null) |
| 262 | { |
| 263 | $enum = [self::ENDCAP_FLAT, self::ENDCAP_SQUARE, self::ENDCAP_ROUND]; |
| 264 | $this->endCap = $this->setEnumVal($value, $enum, null); |
| 265 | |
| 266 | return $this; |
| 267 | } |
| 268 | |
| 269 | /** |
| 270 | * Get startArrow. |
| 271 | * |
| 272 | * @return string |
| 273 | */ |
| 274 | public function getStartArrow() |
| 275 | { |
| 276 | return $this->startArrow; |
| 277 | } |
| 278 | |
| 279 | /** |
| 280 | * Set pattern. |
| 281 | * |
| 282 | * @param string $value |
| 283 | * |
| 284 | * @return self |
| 285 | */ |
| 286 | public function setStartArrow($value = null) |
| 287 | { |
| 288 | $enum = [self::ARROW_NONE, self::ARROW_BLOCK, self::ARROW_CLASSIC, |
| 289 | self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN, ]; |
| 290 | $this->startArrow = $this->setEnumVal($value, $enum, null); |
| 291 | |
| 292 | return $this; |
| 293 | } |
| 294 | |
| 295 | /** |
| 296 | * Get endArrow. |
| 297 | * |
| 298 | * @return string |
| 299 | */ |
| 300 | public function getEndArrow() |
| 301 | { |
| 302 | return $this->endArrow; |
| 303 | } |
| 304 | |
| 305 | /** |
| 306 | * Set pattern. |
| 307 | * |
| 308 | * @param string $value |
| 309 | * |
| 310 | * @return self |
| 311 | */ |
| 312 | public function setEndArrow($value = null) |
| 313 | { |
| 314 | $enum = [self::ARROW_NONE, self::ARROW_BLOCK, self::ARROW_CLASSIC, |
| 315 | self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN, ]; |
| 316 | $this->endArrow = $this->setEnumVal($value, $enum, null); |
| 317 | |
| 318 | return $this; |
| 319 | } |
| 320 | } |