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 1.8.0, 2014-03-02
26: */
27:
28:
29: /**
30: * PHPExcel_Calculation_Function
31: *
32: * @category PHPExcel
33: * @package PHPExcel_Calculation
34: * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
35: */
36: class PHPExcel_Calculation_Function {
37: /* Function categories */
38: const CATEGORY_CUBE = 'Cube';
39: const CATEGORY_DATABASE = 'Database';
40: const CATEGORY_DATE_AND_TIME = 'Date and Time';
41: const CATEGORY_ENGINEERING = 'Engineering';
42: const CATEGORY_FINANCIAL = 'Financial';
43: const CATEGORY_INFORMATION = 'Information';
44: const CATEGORY_LOGICAL = 'Logical';
45: const CATEGORY_LOOKUP_AND_REFERENCE = 'Lookup and Reference';
46: const CATEGORY_MATH_AND_TRIG = 'Math and Trig';
47: const CATEGORY_STATISTICAL = 'Statistical';
48: const CATEGORY_TEXT_AND_DATA = 'Text and Data';
49:
50: /**
51: * Category (represented by CATEGORY_*)
52: *
53: * @var string
54: */
55: private $_category;
56:
57: /**
58: * Excel name
59: *
60: * @var string
61: */
62: private $_excelName;
63:
64: /**
65: * PHPExcel name
66: *
67: * @var string
68: */
69: private $_phpExcelName;
70:
71: /**
72: * Create a new PHPExcel_Calculation_Function
73: *
74: * @param string $pCategory Category (represented by CATEGORY_*)
75: * @param string $pExcelName Excel function name
76: * @param string $pPHPExcelName PHPExcel function mapping
77: * @throws PHPExcel_Calculation_Exception
78: */
79: public function __construct($pCategory = NULL, $pExcelName = NULL, $pPHPExcelName = NULL)
80: {
81: if (($pCategory !== NULL) && ($pExcelName !== NULL) && ($pPHPExcelName !== NULL)) {
82: // Initialise values
83: $this->_category = $pCategory;
84: $this->_excelName = $pExcelName;
85: $this->_phpExcelName = $pPHPExcelName;
86: } else {
87: throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
88: }
89: }
90:
91: /**
92: * Get Category (represented by CATEGORY_*)
93: *
94: * @return string
95: */
96: public function getCategory() {
97: return $this->_category;
98: }
99:
100: /**
101: * Set Category (represented by CATEGORY_*)
102: *
103: * @param string $value
104: * @throws PHPExcel_Calculation_Exception
105: */
106: public function setCategory($value = null) {
107: if (!is_null($value)) {
108: $this->_category = $value;
109: } else {
110: throw new PHPExcel_Calculation_Exception("Invalid parameter passed.");
111: }
112: }
113:
114: /**
115: * Get Excel name
116: *
117: * @return string
118: */
119: public function getExcelName() {
120: return $this->_excelName;
121: }
122:
123: /**
124: * Set Excel name
125: *
126: * @param string $value
127: */
128: public function setExcelName($value) {
129: $this->_excelName = $value;
130: }
131:
132: /**
133: * Get PHPExcel name
134: *
135: * @return string
136: */
137: public function getPHPExcelName() {
138: return $this->_phpExcelName;
139: }
140:
141: /**
142: * Set PHPExcel name
143: *
144: * @param string $value
145: */
146: public function setPHPExcelName($value) {
147: $this->_phpExcelName = $value;
148: }
149: }
150: