TextElement.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
  8. {
  9. /**
  10. * Text
  11. *
  12. * @var string
  13. */
  14. private $text;
  15. /**
  16. * Create a new PHPExcel_RichText_TextElement instance
  17. *
  18. * @param string $pText Text
  19. */
  20. public function __construct($pText = '')
  21. {
  22. // Initialise variables
  23. $this->text = $pText;
  24. }
  25. /**
  26. * Get text
  27. *
  28. * @return string Text
  29. */
  30. public function getText()
  31. {
  32. return $this->text;
  33. }
  34. /**
  35. * Set text
  36. *
  37. * @param $pText string Text
  38. * @return PHPExcel_RichText_ITextElement
  39. */
  40. public function setText($pText = '')
  41. {
  42. $this->text = $pText;
  43. return $this;
  44. }
  45. /**
  46. * Get font
  47. *
  48. * @return PHPExcel_Style_Font
  49. */
  50. public function getFont()
  51. {
  52. return null;
  53. }
  54. /**
  55. * Get hash code
  56. *
  57. * @return string Hash code
  58. */
  59. public function getHashCode()
  60. {
  61. return md5(
  62. $this->text .
  63. __CLASS__
  64. );
  65. }
  66. /**
  67. * Implement PHP __clone to create a deep clone, not just a shallow copy.
  68. */
  69. public function __clone()
  70. {
  71. $vars = get_object_vars($this);
  72. foreach ($vars as $key => $value) {
  73. if (is_object($value)) {
  74. $this->$key = clone $value;
  75. } else {
  76. $this->$key = $value;
  77. }
  78. }
  79. }
  80. }