Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
16 / 16 |
|
100.00% |
11 / 11 |
CRAP | |
100.00% |
1 / 1 |
| Indentation | |
100.00% |
16 / 16 |
|
100.00% |
11 / 11 |
11 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLeft | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setLeft | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getRight | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setRight | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getFirstLine | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setFirstLine | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getFirstLineChars | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setFirstLineChars | |
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 | |||
| 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 | * Paragraph indentation style. |
| 23 | * |
| 24 | * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_Ind.html |
| 25 | * @since 0.10.0 |
| 26 | */ |
| 27 | class Indentation extends AbstractStyle |
| 28 | { |
| 29 | /** |
| 30 | * Left indentation (twip). |
| 31 | * |
| 32 | * @var null|float |
| 33 | */ |
| 34 | private $left = 0; |
| 35 | |
| 36 | /** |
| 37 | * Right indentation (twip). |
| 38 | * |
| 39 | * @var null|float |
| 40 | */ |
| 41 | private $right = 0; |
| 42 | |
| 43 | /** |
| 44 | * Additional first line indentation (twip). |
| 45 | * |
| 46 | * @var null|float |
| 47 | */ |
| 48 | private $firstLine = 0; |
| 49 | |
| 50 | /** |
| 51 | * Additional first line chars indentation (twip). |
| 52 | * |
| 53 | * @var int |
| 54 | */ |
| 55 | private $firstLineChars = 0; |
| 56 | |
| 57 | /** |
| 58 | * Indentation removed from first line (twip). |
| 59 | * |
| 60 | * @var null|float |
| 61 | */ |
| 62 | private $hanging = 0; |
| 63 | |
| 64 | /** |
| 65 | * Create a new instance. |
| 66 | * |
| 67 | * @param array $style |
| 68 | */ |
| 69 | public function __construct($style = []) |
| 70 | { |
| 71 | $this->setStyleByArray($style); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Get left. |
| 76 | */ |
| 77 | public function getLeft(): ?float |
| 78 | { |
| 79 | return $this->left; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Set left. |
| 84 | */ |
| 85 | public function setLeft(?float $value): self |
| 86 | { |
| 87 | $this->left = $this->setNumericVal($value); |
| 88 | |
| 89 | return $this; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Get right. |
| 94 | */ |
| 95 | public function getRight(): ?float |
| 96 | { |
| 97 | return $this->right; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Set right. |
| 102 | */ |
| 103 | public function setRight(?float $value): self |
| 104 | { |
| 105 | $this->right = $this->setNumericVal($value); |
| 106 | |
| 107 | return $this; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Get first line. |
| 112 | */ |
| 113 | public function getFirstLine(): ?float |
| 114 | { |
| 115 | return $this->firstLine; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * Set first line. |
| 120 | */ |
| 121 | public function setFirstLine(?float $value): self |
| 122 | { |
| 123 | $this->firstLine = $this->setNumericVal($value); |
| 124 | |
| 125 | return $this; |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Get first line chars. |
| 130 | */ |
| 131 | public function getFirstLineChars(): int |
| 132 | { |
| 133 | return $this->firstLineChars; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Set first line chars. |
| 138 | */ |
| 139 | public function setFirstLineChars(int $value): self |
| 140 | { |
| 141 | $this->firstLineChars = $this->setIntVal($value, $this->firstLineChars); |
| 142 | |
| 143 | return $this; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * Get hanging. |
| 148 | */ |
| 149 | public function getHanging(): ?float |
| 150 | { |
| 151 | return $this->hanging; |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Set hanging. |
| 156 | */ |
| 157 | public function setHanging(?float $value = null): self |
| 158 | { |
| 159 | $this->hanging = $this->setNumericVal($value); |
| 160 | |
| 161 | return $this; |
| 162 | } |
| 163 | } |