Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
23 / 23 |
|
100.00% |
16 / 16 |
CRAP | |
100.00% |
1 / 1 |
| View3D | |
100.00% |
23 / 23 |
|
100.00% |
16 / 16 |
17 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getRotationX | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setRotationX | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getRotationY | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setRotationY | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| hasRightAngleAxes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setRightAngleAxes | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getPerspective | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setPerspective | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getHeightPercent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setHeightPercent | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getDepthPercent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setDepthPercent | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getHashCode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| 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\Shape\Chart; |
| 21 | |
| 22 | use PhpOffice\PhpPresentation\ComparableInterface; |
| 23 | |
| 24 | /** |
| 25 | * \PhpOffice\PhpPresentation\Shape\Chart\View3D. |
| 26 | */ |
| 27 | class View3D implements ComparableInterface |
| 28 | { |
| 29 | /** |
| 30 | * Rotation X. |
| 31 | * |
| 32 | * @var int |
| 33 | */ |
| 34 | protected $rotationX = 0; |
| 35 | |
| 36 | /** |
| 37 | * Rotation Y. |
| 38 | * |
| 39 | * @var int |
| 40 | */ |
| 41 | protected $rotationY = 0; |
| 42 | |
| 43 | /** |
| 44 | * Right Angle Axes. |
| 45 | * |
| 46 | * @var bool |
| 47 | */ |
| 48 | private $rightAngleAxes = true; |
| 49 | |
| 50 | /** |
| 51 | * Perspective. |
| 52 | * |
| 53 | * @var int |
| 54 | */ |
| 55 | private $perspective = 30; |
| 56 | |
| 57 | /** |
| 58 | * Height Percent. |
| 59 | * |
| 60 | * @var null|int |
| 61 | */ |
| 62 | private $heightPercent = 100; |
| 63 | |
| 64 | /** |
| 65 | * Depth Percent. |
| 66 | * |
| 67 | * @var int |
| 68 | */ |
| 69 | private $depthPercent = 100; |
| 70 | |
| 71 | /** |
| 72 | * Hash index. |
| 73 | * |
| 74 | * @var int |
| 75 | */ |
| 76 | private $hashIndex; |
| 77 | |
| 78 | /** |
| 79 | * Create a new \PhpOffice\PhpPresentation\Shape\Chart\View3D instance. |
| 80 | */ |
| 81 | public function __construct() |
| 82 | { |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Get Rotation X. |
| 87 | * |
| 88 | * @return int |
| 89 | */ |
| 90 | public function getRotationX() |
| 91 | { |
| 92 | return $this->rotationX; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Set Rotation X (-90 to 90). |
| 97 | * |
| 98 | * @param int $pValue |
| 99 | * |
| 100 | * @return View3D |
| 101 | */ |
| 102 | public function setRotationX($pValue = 0) |
| 103 | { |
| 104 | $this->rotationX = $pValue; |
| 105 | |
| 106 | return $this; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Get Rotation Y. |
| 111 | * |
| 112 | * @return int |
| 113 | */ |
| 114 | public function getRotationY() |
| 115 | { |
| 116 | return $this->rotationY; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Set Rotation Y (-90 to 90). |
| 121 | * |
| 122 | * @param int $pValue |
| 123 | * |
| 124 | * @return View3D |
| 125 | */ |
| 126 | public function setRotationY($pValue = 0) |
| 127 | { |
| 128 | $this->rotationY = $pValue; |
| 129 | |
| 130 | return $this; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Get RightAngleAxes. |
| 135 | * |
| 136 | * @return bool |
| 137 | */ |
| 138 | public function hasRightAngleAxes() |
| 139 | { |
| 140 | return $this->rightAngleAxes; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * Set RightAngleAxes. |
| 145 | * |
| 146 | * @param bool $value |
| 147 | * |
| 148 | * @return View3D |
| 149 | */ |
| 150 | public function setRightAngleAxes($value = true) |
| 151 | { |
| 152 | $this->rightAngleAxes = $value; |
| 153 | |
| 154 | return $this; |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Get Perspective. |
| 159 | * |
| 160 | * @return int |
| 161 | */ |
| 162 | public function getPerspective() |
| 163 | { |
| 164 | return $this->perspective; |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Set Perspective (0 to 100). |
| 169 | * |
| 170 | * @param int $value |
| 171 | * |
| 172 | * @return View3D |
| 173 | */ |
| 174 | public function setPerspective($value = 30) |
| 175 | { |
| 176 | $this->perspective = $value; |
| 177 | |
| 178 | return $this; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * Get HeightPercent. |
| 183 | * |
| 184 | * @return int |
| 185 | */ |
| 186 | public function getHeightPercent() |
| 187 | { |
| 188 | return $this->heightPercent; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * Set HeightPercent (5 to 500). |
| 193 | */ |
| 194 | public function setHeightPercent(?int $value = 100): self |
| 195 | { |
| 196 | $this->heightPercent = $value; |
| 197 | |
| 198 | return $this; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Get DepthPercent. |
| 203 | */ |
| 204 | public function getDepthPercent(): ?int |
| 205 | { |
| 206 | return $this->depthPercent; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * Set DepthPercent (20 to 2000). |
| 211 | * |
| 212 | * @param int $value |
| 213 | * |
| 214 | * @return $this |
| 215 | */ |
| 216 | public function setDepthPercent($value = 100) |
| 217 | { |
| 218 | $this->depthPercent = $value; |
| 219 | |
| 220 | return $this; |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Get hash code. |
| 225 | * |
| 226 | * @return string Hash code |
| 227 | */ |
| 228 | public function getHashCode(): string |
| 229 | { |
| 230 | return md5($this->rotationX . $this->rotationY . ($this->rightAngleAxes ? 't' : 'f') . $this->perspective . $this->heightPercent . $this->depthPercent . __CLASS__); |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Get hash index. |
| 235 | * |
| 236 | * Note that this index may vary during script execution! Only reliable moment is |
| 237 | * while doing a write of a workbook and when changes are not allowed. |
| 238 | * |
| 239 | * @return null|int Hash index |
| 240 | */ |
| 241 | public function getHashIndex(): ?int |
| 242 | { |
| 243 | return $this->hashIndex; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Set hash index. |
| 248 | * |
| 249 | * Note that this index may vary during script execution! Only reliable moment is |
| 250 | * while doing a write of a workbook and when changes are not allowed. |
| 251 | * |
| 252 | * @param int $value Hash index |
| 253 | * |
| 254 | * @return View3D |
| 255 | */ |
| 256 | public function setHashIndex(int $value) |
| 257 | { |
| 258 | $this->hashIndex = $value; |
| 259 | |
| 260 | return $this; |
| 261 | } |
| 262 | } |