Excel2007Theme.Class.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: phperstar
  5. * Date: 2020/8/11
  6. * Time: 3:04 PM
  7. */
  8. namespace Util\PHPExcel\Reader;
  9. class Excel2007Theme
  10. {
  11. /**
  12. * Theme Name
  13. *
  14. * @var string
  15. */
  16. private $themeName;
  17. /**
  18. * Colour Scheme Name
  19. *
  20. * @var string
  21. */
  22. private $colourSchemeName;
  23. /**
  24. * Colour Map indexed by position
  25. *
  26. * @var array of string
  27. */
  28. private $colourMapValues;
  29. /**
  30. * Colour Map
  31. *
  32. * @var array of string
  33. */
  34. private $colourMap;
  35. /**
  36. * Create a new PHPExcel_Theme
  37. *
  38. */
  39. public function __construct($themeName, $colourSchemeName, $colourMap)
  40. {
  41. // Initialise values
  42. $this->themeName = $themeName;
  43. $this->colourSchemeName = $colourSchemeName;
  44. $this->colourMap = $colourMap;
  45. }
  46. /**
  47. * Get Theme Name
  48. *
  49. * @return string
  50. */
  51. public function getThemeName()
  52. {
  53. return $this->themeName;
  54. }
  55. /**
  56. * Get colour Scheme Name
  57. *
  58. * @return string
  59. */
  60. public function getColourSchemeName()
  61. {
  62. return $this->colourSchemeName;
  63. }
  64. /**
  65. * Get colour Map Value by Position
  66. *
  67. * @return string
  68. */
  69. public function getColourByIndex($index = 0)
  70. {
  71. if (isset($this->colourMap[$index])) {
  72. return $this->colourMap[$index];
  73. }
  74. return null;
  75. }
  76. /**
  77. * Implement PHP __clone to create a deep clone, not just a shallow copy.
  78. */
  79. public function __clone()
  80. {
  81. $vars = get_object_vars($this);
  82. foreach ($vars as $key => $value) {
  83. if ((is_object($value)) && ($key != '_parent')) {
  84. $this->$key = clone $value;
  85. } else {
  86. $this->$key = $value;
  87. }
  88. }
  89. }
  90. }