← All changes
|
vendor/phpoffice/phpexcel/Classes/PHPExcel/Comment.php
+74
-85
3.1.0
→
3.0.10
View file →
| @@ -1,10 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | 2 | /** |
| 4 | - * PHPExcel_Comment | |
| 3 | + * PHPExcel | |
| 5 | 4 | * |
| 6 | - * Copyright (c) 2006 - 2015 PHPExcel | |
| 5 | + * Copyright (c) 2006 - 2014 PHPExcel | |
| 7 | 6 | * |
| 8 | 7 | * This library is free software; you can redistribute it and/or |
| 9 | 8 | * modify it under the terms of the GNU Lesser General Public |
| 10 | 9 | * License as published by the Free Software Foundation; either |
| @@ -20,12 +19,21 @@ | ||
| 20 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | 20 | * |
| 22 | 21 | * @category PHPExcel |
| 23 | 22 | * @package PHPExcel |
| 24 | - * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | |
| 23 | + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) | |
| 25 | 24 | * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
| 26 | 25 | * @version ##VERSION##, ##DATE## |
| 27 | 26 | */ |
| 27 | + | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * PHPExcel_Comment | |
| 31 | + * | |
| 32 | + * @category PHPExcel | |
| 33 | + * @package PHPExcel | |
| 34 | + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) | |
| 35 | + */ | |
| 28 | 36 | class PHPExcel_Comment implements PHPExcel_IComparable |
| 29 | 37 | { |
| 30 | 38 | /** |
| 31 | 39 | * Author |
| @@ -31,9 +39,9 @@ | ||
| 31 | 39 | * Author |
| 32 | 40 | * |
| 33 | 41 | * @var string |
| 34 | 42 | */ |
| 35 | - private $author; | |
| 43 | + private $_author; | |
| 36 | 44 | |
| 37 | 45 | /** |
| 38 | 46 | * Rich text comment |
| 39 | 47 | * |
| @@ -38,9 +46,9 @@ | ||
| 38 | 46 | * Rich text comment |
| 39 | 47 | * |
| 40 | 48 | * @var PHPExcel_RichText |
| 41 | 49 | */ |
| 42 | - private $text; | |
| 50 | + private $_text; | |
| 43 | 51 | |
| 44 | 52 | /** |
| 45 | 53 | * Comment width (CSS style, i.e. XXpx or YYpt) |
| 46 | 54 | * |
| @@ -45,9 +53,9 @@ | ||
| 45 | 53 | * Comment width (CSS style, i.e. XXpx or YYpt) |
| 46 | 54 | * |
| 47 | 55 | * @var string |
| 48 | 56 | */ |
| 49 | - private $width = '96pt'; | |
| 57 | + private $_width = '96pt'; | |
| 50 | 58 | |
| 51 | 59 | /** |
| 52 | 60 | * Left margin (CSS style, i.e. XXpx or YYpt) |
| 53 | 61 | * |
| @@ -52,9 +60,9 @@ | ||
| 52 | 60 | * Left margin (CSS style, i.e. XXpx or YYpt) |
| 53 | 61 | * |
| 54 | 62 | * @var string |
| 55 | 63 | */ |
| 56 | - private $marginLeft = '59.25pt'; | |
| 64 | + private $_marginLeft = '59.25pt'; | |
| 57 | 65 | |
| 58 | 66 | /** |
| 59 | 67 | * Top margin (CSS style, i.e. XXpx or YYpt) |
| 60 | 68 | * |
| @@ -59,9 +67,9 @@ | ||
| 59 | 67 | * Top margin (CSS style, i.e. XXpx or YYpt) |
| 60 | 68 | * |
| 61 | 69 | * @var string |
| 62 | 70 | */ |
| 63 | - private $marginTop = '1.5pt'; | |
| 71 | + private $_marginTop = '1.5pt'; | |
| 64 | 72 | |
| 65 | 73 | /** |
| 66 | 74 | * Visible |
| 67 | 75 | * |
| @@ -66,9 +74,9 @@ | ||
| 66 | 74 | * Visible |
| 67 | 75 | * |
| 68 | 76 | * @var boolean |
| 69 | 77 | */ |
| 70 | - private $visible = false; | |
| 78 | + private $_visible = false; | |
| 71 | 79 | |
| 72 | 80 | /** |
| 73 | 81 | * Comment height (CSS style, i.e. XXpx or YYpt) |
| 74 | 82 | * |
| @@ -73,9 +81,9 @@ | ||
| 73 | 81 | * Comment height (CSS style, i.e. XXpx or YYpt) |
| 74 | 82 | * |
| 75 | 83 | * @var string |
| 76 | 84 | */ |
| 77 | - private $height = '55.5pt'; | |
| 85 | + private $_height = '55.5pt'; | |
| 78 | 86 | |
| 79 | 87 | /** |
| 80 | 88 | * Comment fill color |
| 81 | 89 | * |
| @@ -80,9 +88,9 @@ | ||
| 80 | 88 | * Comment fill color |
| 81 | 89 | * |
| 82 | 90 | * @var PHPExcel_Style_Color |
| 83 | 91 | */ |
| 84 | - private $fillColor; | |
| 92 | + private $_fillColor; | |
| 85 | 93 | |
| 86 | 94 | /** |
| 87 | 95 | * Alignment |
| 88 | 96 | * |
| @@ -87,9 +95,9 @@ | ||
| 87 | 95 | * Alignment |
| 88 | 96 | * |
| 89 | 97 | * @var string |
| 90 | 98 | */ |
| 91 | - private $alignment; | |
| 99 | + private $_alignment; | |
| 92 | 100 | |
| 93 | 101 | /** |
| 94 | 102 | * Create a new PHPExcel_Comment |
| 95 | 103 | * |
| @@ -97,12 +105,12 @@ | ||
| 97 | 105 | */ |
| 98 | 106 | public function __construct() |
| 99 | 107 | { |
| 100 | 108 | // Initialise variables |
| 101 | - $this->author = 'Author'; | |
| 102 | - $this->text = new PHPExcel_RichText(); | |
| 103 | - $this->fillColor = new PHPExcel_Style_Color('FFFFFFE1'); | |
| 104 | - $this->alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; | |
| 109 | + $this->_author = 'Author'; | |
| 110 | + $this->_text = new PHPExcel_RichText(); | |
| 111 | + $this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1'); | |
| 112 | + $this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; | |
| 105 | 113 | } |
| 106 | 114 | |
| 107 | 115 | /** |
| 108 | 116 | * Get Author |
| @@ -108,11 +116,10 @@ | ||
| 108 | 116 | * Get Author |
| 109 | 117 | * |
| 110 | 118 | * @return string |
| 111 | 119 | */ |
| 112 | - public function getAuthor() | |
| 113 | - { | |
| 114 | - return $this->author; | |
| 120 | + public function getAuthor() { | |
| 121 | + return $this->_author; | |
| 115 | 122 | } |
| 116 | 123 | |
| 117 | 124 | /** |
| 118 | 125 | * Set Author |
| @@ -119,11 +126,10 @@ | ||
| 119 | 126 | * |
| 120 | 127 | * @param string $pValue |
| 121 | 128 | * @return PHPExcel_Comment |
| 122 | 129 | */ |
| 123 | - public function setAuthor($pValue = '') | |
| 124 | - { | |
| 125 | - $this->author = $pValue; | |
| 130 | + public function setAuthor($pValue = '') { | |
| 131 | + $this->_author = $pValue; | |
| 126 | 132 | return $this; |
| 127 | 133 | } |
| 128 | 134 | |
| 129 | 135 | /** |
| @@ -130,11 +136,10 @@ | ||
| 130 | 136 | * Get Rich text comment |
| 131 | 137 | * |
| 132 | 138 | * @return PHPExcel_RichText |
| 133 | 139 | */ |
| 134 | - public function getText() | |
| 135 | - { | |
| 136 | - return $this->text; | |
| 140 | + public function getText() { | |
| 141 | + return $this->_text; | |
| 137 | 142 | } |
| 138 | 143 | |
| 139 | 144 | /** |
| 140 | 145 | * Set Rich text comment |
| @@ -141,11 +146,10 @@ | ||
| 141 | 146 | * |
| 142 | 147 | * @param PHPExcel_RichText $pValue |
| 143 | 148 | * @return PHPExcel_Comment |
| 144 | 149 | */ |
| 145 | - public function setText(PHPExcel_RichText $pValue) | |
| 146 | - { | |
| 147 | - $this->text = $pValue; | |
| 150 | + public function setText(PHPExcel_RichText $pValue) { | |
| 151 | + $this->_text = $pValue; | |
| 148 | 152 | return $this; |
| 149 | 153 | } |
| 150 | 154 | |
| 151 | 155 | /** |
| @@ -152,11 +156,10 @@ | ||
| 152 | 156 | * Get comment width (CSS style, i.e. XXpx or YYpt) |
| 153 | 157 | * |
| 154 | 158 | * @return string |
| 155 | 159 | */ |
| 156 | - public function getWidth() | |
| 157 | - { | |
| 158 | - return $this->width; | |
| 160 | + public function getWidth() { | |
| 161 | + return $this->_width; | |
| 159 | 162 | } |
| 160 | 163 | |
| 161 | 164 | /** |
| 162 | 165 | * Set comment width (CSS style, i.e. XXpx or YYpt) |
| @@ -163,11 +166,10 @@ | ||
| 163 | 166 | * |
| 164 | 167 | * @param string $value |
| 165 | 168 | * @return PHPExcel_Comment |
| 166 | 169 | */ |
| 167 | - public function setWidth($value = '96pt') | |
| 168 | - { | |
| 169 | - $this->width = $value; | |
| 170 | + public function setWidth($value = '96pt') { | |
| 171 | + $this->_width = $value; | |
| 170 | 172 | return $this; |
| 171 | 173 | } |
| 172 | 174 | |
| 173 | 175 | /** |
| @@ -174,11 +176,10 @@ | ||
| 174 | 176 | * Get comment height (CSS style, i.e. XXpx or YYpt) |
| 175 | 177 | * |
| 176 | 178 | * @return string |
| 177 | 179 | */ |
| 178 | - public function getHeight() | |
| 179 | - { | |
| 180 | - return $this->height; | |
| 180 | + public function getHeight() { | |
| 181 | + return $this->_height; | |
| 181 | 182 | } |
| 182 | 183 | |
| 183 | 184 | /** |
| 184 | 185 | * Set comment height (CSS style, i.e. XXpx or YYpt) |
| @@ -185,11 +186,10 @@ | ||
| 185 | 186 | * |
| 186 | 187 | * @param string $value |
| 187 | 188 | * @return PHPExcel_Comment |
| 188 | 189 | */ |
| 189 | - public function setHeight($value = '55.5pt') | |
| 190 | - { | |
| 191 | - $this->height = $value; | |
| 190 | + public function setHeight($value = '55.5pt') { | |
| 191 | + $this->_height = $value; | |
| 192 | 192 | return $this; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
| @@ -196,11 +196,10 @@ | ||
| 196 | 196 | * Get left margin (CSS style, i.e. XXpx or YYpt) |
| 197 | 197 | * |
| 198 | 198 | * @return string |
| 199 | 199 | */ |
| 200 | - public function getMarginLeft() | |
| 201 | - { | |
| 202 | - return $this->marginLeft; | |
| 200 | + public function getMarginLeft() { | |
| 201 | + return $this->_marginLeft; | |
| 203 | 202 | } |
| 204 | 203 | |
| 205 | 204 | /** |
| 206 | 205 | * Set left margin (CSS style, i.e. XXpx or YYpt) |
| @@ -207,11 +206,10 @@ | ||
| 207 | 206 | * |
| 208 | 207 | * @param string $value |
| 209 | 208 | * @return PHPExcel_Comment |
| 210 | 209 | */ |
| 211 | - public function setMarginLeft($value = '59.25pt') | |
| 212 | - { | |
| 213 | - $this->marginLeft = $value; | |
| 210 | + public function setMarginLeft($value = '59.25pt') { | |
| 211 | + $this->_marginLeft = $value; | |
| 214 | 212 | return $this; |
| 215 | 213 | } |
| 216 | 214 | |
| 217 | 215 | /** |
| @@ -218,11 +216,10 @@ | ||
| 218 | 216 | * Get top margin (CSS style, i.e. XXpx or YYpt) |
| 219 | 217 | * |
| 220 | 218 | * @return string |
| 221 | 219 | */ |
| 222 | - public function getMarginTop() | |
| 223 | - { | |
| 224 | - return $this->marginTop; | |
| 220 | + public function getMarginTop() { | |
| 221 | + return $this->_marginTop; | |
| 225 | 222 | } |
| 226 | 223 | |
| 227 | 224 | /** |
| 228 | 225 | * Set top margin (CSS style, i.e. XXpx or YYpt) |
| @@ -229,11 +226,10 @@ | ||
| 229 | 226 | * |
| 230 | 227 | * @param string $value |
| 231 | 228 | * @return PHPExcel_Comment |
| 232 | 229 | */ |
| 233 | - public function setMarginTop($value = '1.5pt') | |
| 234 | - { | |
| 235 | - $this->marginTop = $value; | |
| 230 | + public function setMarginTop($value = '1.5pt') { | |
| 231 | + $this->_marginTop = $value; | |
| 236 | 232 | return $this; |
| 237 | 233 | } |
| 238 | 234 | |
| 239 | 235 | /** |
| @@ -240,11 +236,10 @@ | ||
| 240 | 236 | * Is the comment visible by default? |
| 241 | 237 | * |
| 242 | 238 | * @return boolean |
| 243 | 239 | */ |
| 244 | - public function getVisible() | |
| 245 | - { | |
| 246 | - return $this->visible; | |
| 240 | + public function getVisible() { | |
| 241 | + return $this->_visible; | |
| 247 | 242 | } |
| 248 | 243 | |
| 249 | 244 | /** |
| 250 | 245 | * Set comment default visibility |
| @@ -251,11 +246,10 @@ | ||
| 251 | 246 | * |
| 252 | 247 | * @param boolean $value |
| 253 | 248 | * @return PHPExcel_Comment |
| 254 | 249 | */ |
| 255 | - public function setVisible($value = false) | |
| 256 | - { | |
| 257 | - $this->visible = $value; | |
| 250 | + public function setVisible($value = false) { | |
| 251 | + $this->_visible = $value; | |
| 258 | 252 | return $this; |
| 259 | 253 | } |
| 260 | 254 | |
| 261 | 255 | /** |
| @@ -262,11 +256,10 @@ | ||
| 262 | 256 | * Get fill color |
| 263 | 257 | * |
| 264 | 258 | * @return PHPExcel_Style_Color |
| 265 | 259 | */ |
| 266 | - public function getFillColor() | |
| 267 | - { | |
| 268 | - return $this->fillColor; | |
| 260 | + public function getFillColor() { | |
| 261 | + return $this->_fillColor; | |
| 269 | 262 | } |
| 270 | 263 | |
| 271 | 264 | /** |
| 272 | 265 | * Set Alignment |
| @@ -273,11 +266,10 @@ | ||
| 273 | 266 | * |
| 274 | 267 | * @param string $pValue |
| 275 | 268 | * @return PHPExcel_Comment |
| 276 | 269 | */ |
| 277 | - public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) | |
| 278 | - { | |
| 279 | - $this->alignment = $pValue; | |
| 270 | + public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) { | |
| 271 | + $this->_alignment = $pValue; | |
| 280 | 272 | return $this; |
| 281 | 273 | } |
| 282 | 274 | |
| 283 | 275 | /** |
| @@ -284,11 +276,10 @@ | ||
| 284 | 276 | * Get Alignment |
| 285 | 277 | * |
| 286 | 278 | * @return string |
| 287 | 279 | */ |
| 288 | - public function getAlignment() | |
| 289 | - { | |
| 290 | - return $this->alignment; | |
| 280 | + public function getAlignment() { | |
| 281 | + return $this->_alignment; | |
| 291 | 282 | } |
| 292 | 283 | |
| 293 | 284 | /** |
| 294 | 285 | * Get hash code |
| @@ -294,21 +285,20 @@ | ||
| 294 | 285 | * Get hash code |
| 295 | 286 | * |
| 296 | 287 | * @return string Hash code |
| 297 | 288 | */ |
| 298 | - public function getHashCode() | |
| 299 | - { | |
| 289 | + public function getHashCode() { | |
| 300 | 290 | return md5( |
| 301 | - $this->author . | |
| 302 | - $this->text->getHashCode() . | |
| 303 | - $this->width . | |
| 304 | - $this->height . | |
| 305 | - $this->marginLeft . | |
| 306 | - $this->marginTop . | |
| 307 | - ($this->visible ? 1 : 0) . | |
| 308 | - $this->fillColor->getHashCode() . | |
| 309 | - $this->alignment . | |
| 310 | - __CLASS__ | |
| 291 | + $this->_author | |
| 292 | + . $this->_text->getHashCode() | |
| 293 | + . $this->_width | |
| 294 | + . $this->_height | |
| 295 | + . $this->_marginLeft | |
| 296 | + . $this->_marginTop | |
| 297 | + . ($this->_visible ? 1 : 0) | |
| 298 | + . $this->_fillColor->getHashCode() | |
| 299 | + . $this->_alignment | |
| 300 | + . __CLASS__ | |
| 311 | 301 | ); |
| 312 | 302 | } |
| 313 | 303 | |
| 314 | 304 | /** |
| @@ -313,10 +303,9 @@ | ||
| 313 | 303 | |
| 314 | 304 | /** |
| 315 | 305 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
| 316 | 306 | */ |
| 317 | - public function __clone() | |
| 318 | - { | |
| 307 | + public function __clone() { | |
| 319 | 308 | $vars = get_object_vars($this); |
| 320 | 309 | foreach ($vars as $key => $value) { |
| 321 | 310 | if (is_object($value)) { |
| 322 | 311 | $this->$key = clone $value; |
| @@ -330,9 +319,9 @@ | ||
| 330 | 319 | * Convert to string |
| 331 | 320 | * |
| 332 | 321 | * @return string |
| 333 | 322 | */ |
| 334 | - public function __toString() | |
| 335 | - { | |
| 336 | - return $this->text->getPlainText(); | |
| 323 | + public function __toString() { | |
| 324 | + return $this->_text->getPlainText(); | |
| 337 | 325 | } |
| 326 | + | |
| 338 | 327 | } |