PageRenderTime 44ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/PHPExcel_1.7.8-with_documentation-msoffice_format/Classes/PHPExcel/RichText/TextElement.php

https://bitbucket.org/izubizarreta/https-bitbucket.org-bityvip
PHP | 108 lines | 35 code | 8 blank | 65 comment | 2 complexity | 9b8540bf23bf150c00aa21bd867cbeac MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.0, JSON, GPL-2.0, BSD-3-Clause, LGPL-2.1, MIT
  1. <?php
  2. /**
  3. * PHPExcel
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. *
  19. * @category PHPExcel
  20. * @package PHPExcel_RichText
  21. * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
  22. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  23. * @version 1.7.8, 2012-10-12
  24. */
  25. /**
  26. * PHPExcel_RichText_TextElement
  27. *
  28. * @category PHPExcel
  29. * @package PHPExcel_RichText
  30. * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
  31. */
  32. class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
  33. {
  34. /**
  35. * Text
  36. *
  37. * @var string
  38. */
  39. private $_text;
  40. /**
  41. * Create a new PHPExcel_RichText_TextElement instance
  42. *
  43. * @param string $pText Text
  44. */
  45. public function __construct($pText = '')
  46. {
  47. // Initialise variables
  48. $this->_text = $pText;
  49. }
  50. /**
  51. * Get text
  52. *
  53. * @return string Text
  54. */
  55. public function getText() {
  56. return $this->_text;
  57. }
  58. /**
  59. * Set text
  60. *
  61. * @param $pText string Text
  62. * @return PHPExcel_RichText_ITextElement
  63. */
  64. public function setText($pText = '') {
  65. $this->_text = $pText;
  66. return $this;
  67. }
  68. /**
  69. * Get font
  70. *
  71. * @return PHPExcel_Style_Font
  72. */
  73. public function getFont() {
  74. return null;
  75. }
  76. /**
  77. * Get hash code
  78. *
  79. * @return string Hash code
  80. */
  81. public function getHashCode() {
  82. return md5(
  83. $this->_text
  84. . __CLASS__
  85. );
  86. }
  87. /**
  88. * Implement PHP __clone to create a deep clone, not just a shallow copy.
  89. */
  90. public function __clone() {
  91. $vars = get_object_vars($this);
  92. foreach ($vars as $key => $value) {
  93. if (is_object($value)) {
  94. $this->$key = clone $value;
  95. } else {
  96. $this->$key = $value;
  97. }
  98. }
  99. }
  100. }