Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
42 / 42 |
|
100.00% |
26 / 26 |
CRAP | |
100.00% |
1 / 1 |
| NumberingLevel | |
100.00% |
42 / 42 |
|
100.00% |
26 / 26 |
27 | |
100.00% |
1 / 1 |
| getLevel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setLevel | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getStart | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setStart | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getFormat | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setFormat | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getRestart | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setRestart | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getPStyle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setPStyle | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getSuffix | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setSuffix | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| getText | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setText | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getAlignment | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setAlignment | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| getLeft | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setLeft | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getHanging | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setHanging | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getTabPos | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setTabPos | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getFont | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setFont | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getHint | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setHint | |
100.00% |
3 / 3 |
|
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 | use PhpOffice\PhpWord\SimpleType\Jc; |
| 22 | use PhpOffice\PhpWord\SimpleType\NumberFormat; |
| 23 | |
| 24 | /** |
| 25 | * Numbering level definition. |
| 26 | * |
| 27 | * @see http://www.schemacentral.com/sc/ooxml/e-w_lvl-1.html |
| 28 | * @since 0.10.0 |
| 29 | */ |
| 30 | class NumberingLevel extends AbstractStyle |
| 31 | { |
| 32 | /** |
| 33 | * Level number, 0 to 8 (total 9 levels). |
| 34 | * |
| 35 | * @var int |
| 36 | */ |
| 37 | private $level = 0; |
| 38 | |
| 39 | /** |
| 40 | * Starting value w:start. |
| 41 | * |
| 42 | * @var int |
| 43 | * |
| 44 | * @see http://www.schemacentral.com/sc/ooxml/e-w_start-1.html |
| 45 | */ |
| 46 | private $start = 1; |
| 47 | |
| 48 | /** |
| 49 | * Numbering format w:numFmt, one of PhpOffice\PhpWord\SimpleType\NumberFormat. |
| 50 | * |
| 51 | * @var string |
| 52 | * |
| 53 | * @see http://www.schemacentral.com/sc/ooxml/t-w_ST_NumberFormat.html |
| 54 | */ |
| 55 | private $format; |
| 56 | |
| 57 | /** |
| 58 | * Restart numbering level symbol w:lvlRestart. |
| 59 | * |
| 60 | * @var int |
| 61 | * |
| 62 | * @see http://www.schemacentral.com/sc/ooxml/e-w_lvlRestart-1.html |
| 63 | */ |
| 64 | private $restart; |
| 65 | |
| 66 | /** |
| 67 | * Related paragraph style. |
| 68 | * |
| 69 | * @var string |
| 70 | * |
| 71 | * @see http://www.schemacentral.com/sc/ooxml/e-w_pStyle-2.html |
| 72 | */ |
| 73 | private $pStyle; |
| 74 | |
| 75 | /** |
| 76 | * Content between numbering symbol and paragraph text w:suff. |
| 77 | * |
| 78 | * @var string tab|space|nothing |
| 79 | * |
| 80 | * @see http://www.schemacentral.com/sc/ooxml/e-w_suff-1.html |
| 81 | */ |
| 82 | private $suffix = 'tab'; |
| 83 | |
| 84 | /** |
| 85 | * Numbering level text e.g. %1 for nonbullet or bullet character. |
| 86 | * |
| 87 | * @var string |
| 88 | * |
| 89 | * @see http://www.schemacentral.com/sc/ooxml/e-w_lvlText-1.html |
| 90 | */ |
| 91 | private $text; |
| 92 | |
| 93 | /** |
| 94 | * Justification, w:lvlJc. |
| 95 | * |
| 96 | * @var string one of PhpOffice\PhpWord\SimpleType\Jc |
| 97 | */ |
| 98 | private $alignment = ''; |
| 99 | |
| 100 | /** |
| 101 | * Left. |
| 102 | * |
| 103 | * @var int |
| 104 | */ |
| 105 | private $left; |
| 106 | |
| 107 | /** |
| 108 | * Hanging. |
| 109 | * |
| 110 | * @var int |
| 111 | */ |
| 112 | private $hanging; |
| 113 | |
| 114 | /** |
| 115 | * Tab position. |
| 116 | * |
| 117 | * @var int |
| 118 | */ |
| 119 | private $tabPos; |
| 120 | |
| 121 | /** |
| 122 | * Font family. |
| 123 | * |
| 124 | * @var string |
| 125 | */ |
| 126 | private $font; |
| 127 | |
| 128 | /** |
| 129 | * Hint default|eastAsia|cs. |
| 130 | * |
| 131 | * @var string |
| 132 | * |
| 133 | * @see http://www.schemacentral.com/sc/ooxml/a-w_hint-1.html |
| 134 | */ |
| 135 | private $hint; |
| 136 | |
| 137 | /** |
| 138 | * Get level. |
| 139 | * |
| 140 | * @return int |
| 141 | */ |
| 142 | public function getLevel() |
| 143 | { |
| 144 | return $this->level; |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * Set level. |
| 149 | * |
| 150 | * @param int $value |
| 151 | * |
| 152 | * @return self |
| 153 | */ |
| 154 | public function setLevel($value) |
| 155 | { |
| 156 | $this->level = $this->setIntVal($value, $this->level); |
| 157 | |
| 158 | return $this; |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * Get start. |
| 163 | * |
| 164 | * @return int |
| 165 | */ |
| 166 | public function getStart() |
| 167 | { |
| 168 | return $this->start; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Set start. |
| 173 | * |
| 174 | * @param int $value |
| 175 | * |
| 176 | * @return self |
| 177 | */ |
| 178 | public function setStart($value) |
| 179 | { |
| 180 | $this->start = $this->setIntVal($value, $this->start); |
| 181 | |
| 182 | return $this; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Get format. |
| 187 | * |
| 188 | * @return string |
| 189 | */ |
| 190 | public function getFormat() |
| 191 | { |
| 192 | return $this->format; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Set format. |
| 197 | * |
| 198 | * @param string $value |
| 199 | * |
| 200 | * @return self |
| 201 | */ |
| 202 | public function setFormat($value) |
| 203 | { |
| 204 | $this->format = $this->setEnumVal($value, NumberFormat::values(), $this->format); |
| 205 | |
| 206 | return $this; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * Get restart. |
| 211 | * |
| 212 | * @return int |
| 213 | */ |
| 214 | public function getRestart() |
| 215 | { |
| 216 | return $this->restart; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * Set restart. |
| 221 | * |
| 222 | * @param int $value |
| 223 | * |
| 224 | * @return self |
| 225 | */ |
| 226 | public function setRestart($value) |
| 227 | { |
| 228 | $this->restart = $this->setIntVal($value, $this->restart); |
| 229 | |
| 230 | return $this; |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Get related paragraph style. |
| 235 | * |
| 236 | * @return string |
| 237 | */ |
| 238 | public function getPStyle() |
| 239 | { |
| 240 | return $this->pStyle; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * Set related paragraph style. |
| 245 | * |
| 246 | * @param string $value |
| 247 | * |
| 248 | * @return self |
| 249 | */ |
| 250 | public function setPStyle($value) |
| 251 | { |
| 252 | $this->pStyle = $value; |
| 253 | |
| 254 | return $this; |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * Get suffix. |
| 259 | * |
| 260 | * @return string |
| 261 | */ |
| 262 | public function getSuffix() |
| 263 | { |
| 264 | return $this->suffix; |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * Set suffix. |
| 269 | * |
| 270 | * @param string $value |
| 271 | * |
| 272 | * @return self |
| 273 | */ |
| 274 | public function setSuffix($value) |
| 275 | { |
| 276 | $enum = ['tab', 'space', 'nothing']; |
| 277 | $this->suffix = $this->setEnumVal($value, $enum, $this->suffix); |
| 278 | |
| 279 | return $this; |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * Get text. |
| 284 | * |
| 285 | * @return string |
| 286 | */ |
| 287 | public function getText() |
| 288 | { |
| 289 | return $this->text; |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Set text. |
| 294 | * |
| 295 | * @param string $value |
| 296 | * |
| 297 | * @return self |
| 298 | */ |
| 299 | public function setText($value) |
| 300 | { |
| 301 | $this->text = $value; |
| 302 | |
| 303 | return $this; |
| 304 | } |
| 305 | |
| 306 | /** |
| 307 | * @since 0.13.0 |
| 308 | * |
| 309 | * @return string |
| 310 | */ |
| 311 | public function getAlignment() |
| 312 | { |
| 313 | return $this->alignment; |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * @since 0.13.0 |
| 318 | * |
| 319 | * @param string $value |
| 320 | * |
| 321 | * @return self |
| 322 | */ |
| 323 | public function setAlignment($value) |
| 324 | { |
| 325 | if (Jc::isValid($value)) { |
| 326 | $this->alignment = $value; |
| 327 | } |
| 328 | |
| 329 | return $this; |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * Get left. |
| 334 | * |
| 335 | * @return int |
| 336 | */ |
| 337 | public function getLeft() |
| 338 | { |
| 339 | return $this->left; |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * Set left. |
| 344 | * |
| 345 | * @param int $value |
| 346 | * |
| 347 | * @return self |
| 348 | */ |
| 349 | public function setLeft($value) |
| 350 | { |
| 351 | $this->left = $this->setIntVal($value, $this->left); |
| 352 | |
| 353 | return $this; |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * Get hanging. |
| 358 | * |
| 359 | * @return int |
| 360 | */ |
| 361 | public function getHanging() |
| 362 | { |
| 363 | return $this->hanging; |
| 364 | } |
| 365 | |
| 366 | /** |
| 367 | * Set hanging. |
| 368 | * |
| 369 | * @param int $value |
| 370 | * |
| 371 | * @return self |
| 372 | */ |
| 373 | public function setHanging($value) |
| 374 | { |
| 375 | $this->hanging = $this->setIntVal($value, $this->hanging); |
| 376 | |
| 377 | return $this; |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * Get tab. |
| 382 | * |
| 383 | * @return int |
| 384 | */ |
| 385 | public function getTabPos() |
| 386 | { |
| 387 | return $this->tabPos; |
| 388 | } |
| 389 | |
| 390 | /** |
| 391 | * Set tab. |
| 392 | * |
| 393 | * @param int $value |
| 394 | * |
| 395 | * @return self |
| 396 | */ |
| 397 | public function setTabPos($value) |
| 398 | { |
| 399 | $this->tabPos = $this->setIntVal($value, $this->tabPos); |
| 400 | |
| 401 | return $this; |
| 402 | } |
| 403 | |
| 404 | /** |
| 405 | * Get font. |
| 406 | * |
| 407 | * @return string |
| 408 | */ |
| 409 | public function getFont() |
| 410 | { |
| 411 | return $this->font; |
| 412 | } |
| 413 | |
| 414 | /** |
| 415 | * Set font. |
| 416 | * |
| 417 | * @param string $value |
| 418 | * |
| 419 | * @return self |
| 420 | */ |
| 421 | public function setFont($value) |
| 422 | { |
| 423 | $this->font = $value; |
| 424 | |
| 425 | return $this; |
| 426 | } |
| 427 | |
| 428 | /** |
| 429 | * Get hint. |
| 430 | * |
| 431 | * @return string |
| 432 | */ |
| 433 | public function getHint() |
| 434 | { |
| 435 | return $this->hint; |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * Set hint. |
| 440 | * |
| 441 | * @param string $value |
| 442 | * |
| 443 | * @return self |
| 444 | */ |
| 445 | public function setHint($value = null) |
| 446 | { |
| 447 | $enum = ['default', 'eastAsia', 'cs']; |
| 448 | $this->hint = $this->setEnumVal($value, $enum, $this->hint); |
| 449 | |
| 450 | return $this; |
| 451 | } |
| 452 | } |