012fa72a173587007cab0a9fe89d5a7c8cc4c7ac.svn-base 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. /**
  3. * PHPExcel
  4. *
  5. * Copyright (c) 2006 - 2014 PHPExcel
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * @category PHPExcel
  22. * @package PHPExcel_Calculation
  23. * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
  24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  25. * @version ##VERSION##, ##DATE##
  26. */
  27. /**
  28. * PHPExcel_Calculation_Function
  29. *
  30. * @category PHPExcel
  31. * @package PHPExcel_Calculation
  32. * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
  33. */
  34. class PHPExcel_Calculation_Function {
  35. /* Function categories */
  36. const CATEGORY_CUBE = 'Cube';
  37. const CATEGORY_DATABASE = 'Database';
  38. const CATEGORY_DATE_AND_TIME = 'Date and Time';
  39. const CATEGORY_ENGINEERING = 'Engineering';
  40. const CATEGORY_FINANCIAL = 'Financial';
  41. const CATEGORY_INFORMATION = 'Information';
  42. const CATEGORY_LOGICAL = 'Logical';
  43. const CATEGORY_LOOKUP_AND_REFERENCE = 'Lookup and Reference';
  44. const CATEGORY_MATH_AND_TRIG = 'Math and Trig';
  45. const CATEGORY_STATISTICAL = 'Statistical';
  46. const CATEGORY_TEXT_AND_DATA = 'Text and Data';
  47. /**
  48. * Category (represented by CATEGORY_*)
  49. *
  50. * @var string
  51. */
  52. private $_category;
  53. /**
  54. * Excel name
  55. *
  56. * @var string
  57. */
  58. private $_excelName;
  59. /**
  60. * PHPExcel name
  61. *
  62. * @var string
  63. */
  64. private $_phpExcelName;
  65. /**
  66. * Create a new PHPExcel_Calculation_Function
  67. *
  68. * @param string $pCategory Category (represented by CATEGORY_*)
  69. * @param string $pExcelName Excel function name
  70. * @param string $pPHPExcelName PHPExcel function mapping
  71. * @throws PHPExcel_Calculation_Exception
  72. */
  73. public function __construct($pCategory = NULL, $pExcelName = NULL, $pPHPExcelName = NULL)
  74. {
  75. if (($pCategory !== NULL) && ($pExcelName !== NULL) && ($pPHPExcelName !== NULL)) {
  76. // Initialise values
  77. $this->_category = $pCategory;
  78. $this->_excelName = $pExcelName;
  79. $this->_phpExcelName = $pPHPExcelName;
  80. } else {
  81. throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
  82. }
  83. }
  84. /**
  85. * Get Category (represented by CATEGORY_*)
  86. *
  87. * @return string
  88. */
  89. public function getCategory() {
  90. return $this->_category;
  91. }
  92. /**
  93. * Set Category (represented by CATEGORY_*)
  94. *
  95. * @param string $value
  96. * @throws PHPExcel_Calculation_Exception
  97. */
  98. public function setCategory($value = null) {
  99. if (!is_null($value)) {
  100. $this->_category = $value;
  101. } else {
  102. throw new PHPExcel_Calculation_Exception("Invalid parameter passed.");
  103. }
  104. }
  105. /**
  106. * Get Excel name
  107. *
  108. * @return string
  109. */
  110. public function getExcelName() {
  111. return $this->_excelName;
  112. }
  113. /**
  114. * Set Excel name
  115. *
  116. * @param string $value
  117. */
  118. public function setExcelName($value) {
  119. $this->_excelName = $value;
  120. }
  121. /**
  122. * Get PHPExcel name
  123. *
  124. * @return string
  125. */
  126. public function getPHPExcelName() {
  127. return $this->_phpExcelName;
  128. }
  129. /**
  130. * Set PHPExcel name
  131. *
  132. * @param string $value
  133. */
  134. public function setPHPExcelName($value) {
  135. $this->_phpExcelName = $value;
  136. }
  137. }