Function.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. class PHPExcel_Calculation_Function
  8. {
  9. /* Function categories */
  10. const CATEGORY_CUBE = 'Cube';
  11. const CATEGORY_DATABASE = 'Database';
  12. const CATEGORY_DATE_AND_TIME = 'Date and Time';
  13. const CATEGORY_ENGINEERING = 'Engineering';
  14. const CATEGORY_FINANCIAL = 'Financial';
  15. const CATEGORY_INFORMATION = 'Information';
  16. const CATEGORY_LOGICAL = 'Logical';
  17. const CATEGORY_LOOKUP_AND_REFERENCE = 'Lookup and Reference';
  18. const CATEGORY_MATH_AND_TRIG = 'Math and Trig';
  19. const CATEGORY_STATISTICAL = 'Statistical';
  20. const CATEGORY_TEXT_AND_DATA = 'Text and Data';
  21. /**
  22. * Category (represented by CATEGORY_*)
  23. *
  24. * @var string
  25. */
  26. private $category;
  27. /**
  28. * Excel name
  29. *
  30. * @var string
  31. */
  32. private $excelName;
  33. /**
  34. * PHPExcel name
  35. *
  36. * @var string
  37. */
  38. private $phpExcelName;
  39. /**
  40. * Create a new PHPExcel_Calculation_Function
  41. *
  42. * @param string $pCategory Category (represented by CATEGORY_*)
  43. * @param string $pExcelName Excel function name
  44. * @param string $pPHPExcelName PHPExcel function mapping
  45. * @throws PHPExcel_Calculation_Exception
  46. */
  47. public function __construct($pCategory = null, $pExcelName = null, $pPHPExcelName = null)
  48. {
  49. if (($pCategory !== null) && ($pExcelName !== null) && ($pPHPExcelName !== null)) {
  50. // Initialise values
  51. $this->category = $pCategory;
  52. $this->excelName = $pExcelName;
  53. $this->phpExcelName = $pPHPExcelName;
  54. } else {
  55. throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
  56. }
  57. }
  58. /**
  59. * Get Category (represented by CATEGORY_*)
  60. *
  61. * @return string
  62. */
  63. public function getCategory()
  64. {
  65. return $this->category;
  66. }
  67. /**
  68. * Set Category (represented by CATEGORY_*)
  69. *
  70. * @param string $value
  71. * @throws PHPExcel_Calculation_Exception
  72. */
  73. public function setCategory($value = null)
  74. {
  75. if (!is_null($value)) {
  76. $this->category = $value;
  77. } else {
  78. throw new PHPExcel_Calculation_Exception("Invalid parameter passed.");
  79. }
  80. }
  81. /**
  82. * Get Excel name
  83. *
  84. * @return string
  85. */
  86. public function getExcelName()
  87. {
  88. return $this->excelName;
  89. }
  90. /**
  91. * Set Excel name
  92. *
  93. * @param string $value
  94. */
  95. public function setExcelName($value)
  96. {
  97. $this->excelName = $value;
  98. }
  99. /**
  100. * Get PHPExcel name
  101. *
  102. * @return string
  103. */
  104. public function getPHPExcelName()
  105. {
  106. return $this->phpExcelName;
  107. }
  108. /**
  109. * Set PHPExcel name
  110. *
  111. * @param string $value
  112. */
  113. public function setPHPExcelName($value)
  114. {
  115. $this->phpExcelName = $value;
  116. }
  117. }