Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
26 / 26 |
|
100.00% |
10 / 10 |
CRAP | |
100.00% |
1 / 1 |
| Borders | |
100.00% |
26 / 26 |
|
100.00% |
10 / 10 |
10 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |||
| getLeft | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getRight | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTop | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getBottom | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getDiagonalUp | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getDiagonalDown | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getHashCode | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
| getHashIndex | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setHashIndex | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * This file is part of PHPPresentation - A pure PHP library for reading and writing |
| 4 | * presentations documents. |
| 5 | * |
| 6 | * PHPPresentation 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/PHPPresentation/contributors. |
| 12 | * |
| 13 | * @see https://github.com/PHPOffice/PHPPresentation |
| 14 | * |
| 15 | * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 |
| 16 | */ |
| 17 | |
| 18 | declare(strict_types=1); |
| 19 | |
| 20 | namespace PhpOffice\PhpPresentation\Style; |
| 21 | |
| 22 | use PhpOffice\PhpPresentation\ComparableInterface; |
| 23 | |
| 24 | /** |
| 25 | * \PhpOffice\PhpPresentation\Style\Borders. |
| 26 | */ |
| 27 | class Borders implements ComparableInterface |
| 28 | { |
| 29 | /** |
| 30 | * Left. |
| 31 | * |
| 32 | * @var Border |
| 33 | */ |
| 34 | private $left; |
| 35 | |
| 36 | /** |
| 37 | * Right. |
| 38 | * |
| 39 | * @var Border |
| 40 | */ |
| 41 | private $right; |
| 42 | |
| 43 | /** |
| 44 | * Top. |
| 45 | * |
| 46 | * @var Border |
| 47 | */ |
| 48 | private $top; |
| 49 | |
| 50 | /** |
| 51 | * Bottom. |
| 52 | * |
| 53 | * @var Border |
| 54 | */ |
| 55 | private $bottom; |
| 56 | |
| 57 | /** |
| 58 | * Diagonal up. |
| 59 | * |
| 60 | * @var Border |
| 61 | */ |
| 62 | private $diagonalUp; |
| 63 | |
| 64 | /** |
| 65 | * Diagonal down. |
| 66 | * |
| 67 | * @var Border |
| 68 | */ |
| 69 | private $diagonalDown; |
| 70 | |
| 71 | /** |
| 72 | * Hash index. |
| 73 | * |
| 74 | * @var int |
| 75 | */ |
| 76 | private $hashIndex; |
| 77 | |
| 78 | /** |
| 79 | * Create a new \PhpOffice\PhpPresentation\Style\Borders. |
| 80 | */ |
| 81 | public function __construct() |
| 82 | { |
| 83 | // Initialise values |
| 84 | $this->left = new Border(); |
| 85 | $this->right = new Border(); |
| 86 | $this->top = new Border(); |
| 87 | $this->bottom = new Border(); |
| 88 | $this->diagonalUp = new Border(); |
| 89 | $this->diagonalUp->setLineStyle(Border::LINE_NONE); |
| 90 | $this->diagonalDown = new Border(); |
| 91 | $this->diagonalDown->setLineStyle(Border::LINE_NONE); |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Get Left. |
| 96 | * |
| 97 | * @return Border |
| 98 | */ |
| 99 | public function getLeft() |
| 100 | { |
| 101 | return $this->left; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Get Right. |
| 106 | * |
| 107 | * @return Border |
| 108 | */ |
| 109 | public function getRight() |
| 110 | { |
| 111 | return $this->right; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Get Top. |
| 116 | * |
| 117 | * @return Border |
| 118 | */ |
| 119 | public function getTop() |
| 120 | { |
| 121 | return $this->top; |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * Get Bottom. |
| 126 | * |
| 127 | * @return Border |
| 128 | */ |
| 129 | public function getBottom() |
| 130 | { |
| 131 | return $this->bottom; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Get Diagonal Up. |
| 136 | * |
| 137 | * @return Border |
| 138 | */ |
| 139 | public function getDiagonalUp() |
| 140 | { |
| 141 | return $this->diagonalUp; |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * Get Diagonal Down. |
| 146 | * |
| 147 | * @return Border |
| 148 | */ |
| 149 | public function getDiagonalDown() |
| 150 | { |
| 151 | return $this->diagonalDown; |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Get hash code. |
| 156 | * |
| 157 | * @return string Hash code |
| 158 | */ |
| 159 | public function getHashCode(): string |
| 160 | { |
| 161 | return md5( |
| 162 | $this->getLeft()->getHashCode() |
| 163 | . $this->getRight()->getHashCode() |
| 164 | . $this->getTop()->getHashCode() |
| 165 | . $this->getBottom()->getHashCode() |
| 166 | . $this->getDiagonalUp()->getHashCode() |
| 167 | . $this->getDiagonalDown()->getHashCode() |
| 168 | . __CLASS__ |
| 169 | ); |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * Get hash index. |
| 174 | * |
| 175 | * Note that this index may vary during script execution! Only reliable moment is |
| 176 | * while doing a write of a workbook and when changes are not allowed. |
| 177 | * |
| 178 | * @return null|int Hash index |
| 179 | */ |
| 180 | public function getHashIndex(): ?int |
| 181 | { |
| 182 | return $this->hashIndex; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Set hash index. |
| 187 | * |
| 188 | * Note that this index may vary during script execution! Only reliable moment is |
| 189 | * while doing a write of a workbook and when changes are not allowed. |
| 190 | * |
| 191 | * @param int $value Hash index |
| 192 | * |
| 193 | * @return $this |
| 194 | */ |
| 195 | public function setHashIndex(int $value) |
| 196 | { |
| 197 | $this->hashIndex = $value; |
| 198 | |
| 199 | return $this; |
| 200 | } |
| 201 | } |