Completed
Pull Request — master (#54)
by Reginaldo
41:52
created
app/Vendor/PHPExcel/PHPExcel/CachedObjectStorage/SQLite.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      *
74 74
      * @param	string			$pCoord		Coordinate address of the cell to update
75 75
      * @param	PHPExcel_Cell	$cell		Cell to update
76
-	 * @return	void
76
+	 * @return	PHPExcel_Cell
77 77
      * @throws	Exception
78 78
      */
79 79
 	public function addCacheData($pCoord, PHPExcel_Cell $cell) {
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	private $_DBHandle = null;
51 51
 
52
-    /**
53
-     * Store cell data in cache for the current cell object if it's "dirty",
54
-     *     and the 'nullify' the current cell object
55
-     *
52
+	/**
53
+	 * Store cell data in cache for the current cell object if it's "dirty",
54
+	 *     and the 'nullify' the current cell object
55
+	 *
56 56
 	 * @return	void
57
-     * @throws	Exception
58
-     */
57
+	 * @throws	Exception
58
+	 */
59 59
 	private function _storeData() {
60 60
 		if ($this->_currentCellIsDirty) {
61 61
 			$this->_currentObject->detach();
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	}	//	function _storeData()
69 69
 
70 70
 
71
-    /**
72
-     * Add or Update a cell in cache identified by coordinate address
73
-     *
74
-     * @param	string			$pCoord		Coordinate address of the cell to update
75
-     * @param	PHPExcel_Cell	$cell		Cell to update
71
+	/**
72
+	 * Add or Update a cell in cache identified by coordinate address
73
+	 *
74
+	 * @param	string			$pCoord		Coordinate address of the cell to update
75
+	 * @param	PHPExcel_Cell	$cell		Cell to update
76 76
 	 * @return	void
77
-     * @throws	Exception
78
-     */
77
+	 * @throws	Exception
78
+	 */
79 79
 	public function addCacheData($pCoord, PHPExcel_Cell $cell) {
80 80
 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
81 81
 			$this->_storeData();
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 	}	//	function addCacheData()
90 90
 
91 91
 
92
-    /**
93
-     * Get cell at a specific coordinate
94
-     *
95
-     * @param 	string 			$pCoord		Coordinate of the cell
96
-     * @throws 	Exception
97
-     * @return 	PHPExcel_Cell 	Cell that was found, or null if not found
98
-     */
92
+	/**
93
+	 * Get cell at a specific coordinate
94
+	 *
95
+	 * @param 	string 			$pCoord		Coordinate of the cell
96
+	 * @throws 	Exception
97
+	 * @return 	PHPExcel_Cell 	Cell that was found, or null if not found
98
+	 */
99 99
 	public function getCacheData($pCoord) {
100 100
 		if ($pCoord === $this->_currentObjectID) {
101 101
 			return $this->_currentObject;
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 	}	//	function isDataSet()
149 149
 
150 150
 
151
-    /**
152
-     * Delete a cell in cache identified by coordinate address
153
-     *
154
-     * @param	string			$pCoord		Coordinate address of the cell to delete
155
-     * @throws	Exception
156
-     */
151
+	/**
152
+	 * Delete a cell in cache identified by coordinate address
153
+	 *
154
+	 * @param	string			$pCoord		Coordinate address of the cell to delete
155
+	 * @throws	Exception
156
+	 */
157 157
 	public function deleteCacheData($pCoord) {
158 158
 		if ($pCoord === $this->_currentObjectID) {
159 159
 			$this->_currentObject->detach();
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		if ($this->_currentCellIsDirty) {
61 61
 			$this->_currentObject->detach();
62 62
 
63
-			if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')"))
63
+			if ( ! $this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')"))
64 64
 				throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
65 65
 			$this->_currentCellIsDirty = false;
66 66
 		}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$this->_storeData();
104 104
 
105 105
 		$query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
106
-		$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC);
106
+		$cellResultSet = $this->_DBHandle->query($query, SQLITE_ASSOC);
107 107
 		if ($cellResultSet === false) {
108 108
 			throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
109 109
 		} elseif ($cellResultSet->numRows() == 0) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
 		//	Check if the requested entry exists in the cache
139 139
 		$query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
140
-		$cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC);
140
+		$cellResultSet = $this->_DBHandle->query($query, SQLITE_ASSOC);
141 141
 		if ($cellResultSet === false) {
142 142
 			throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
143 143
 		} elseif ($cellResultSet->numRows() == 0) {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
 		//	Check if the requested entry exists in the cache
164 164
 		$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
165
-		if (!$this->_DBHandle->queryExec($query))
165
+		if ( ! $this->_DBHandle->queryExec($query))
166 166
 			throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
167 167
 
168 168
 		$this->_currentCellIsDirty = false;
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function getCellList() {
178 178
 		$query = "SELECT id FROM kvp_".$this->_TableName;
179
-		$cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC);
179
+		$cellIdsResult = $this->_DBHandle->unbufferedQuery($query, SQLITE_ASSOC);
180 180
 		if ($cellIdsResult === false)
181 181
 			throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
182 182
 
183 183
 		$cellKeys = array();
184
-		foreach($cellIdsResult as $row) {
184
+		foreach ($cellIdsResult as $row) {
185 185
 			$cellKeys[] = $row['id'];
186 186
 		}
187 187
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function copyCellCollection(PHPExcel_Worksheet $parent) {
199 199
 		//	Get a new id for the new table name
200
-		$tableName = str_replace('.','_',$this->_getUniqueID());
201
-		if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
200
+		$tableName = str_replace('.', '_', $this->_getUniqueID());
201
+		if ( ! $this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
202 202
 													AS SELECT * FROM kvp_'.$this->_TableName))
203 203
 			throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
204 204
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return	void
214 214
 	 */
215 215
 	public function unsetWorksheetCells() {
216
-		if(!is_null($this->_currentObject)) {
216
+		if ( ! is_null($this->_currentObject)) {
217 217
 			$this->_currentObject->detach();
218 218
 			$this->_currentObject = $this->_currentObjectID = null;
219 219
 		}
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
 	public function __construct(PHPExcel_Worksheet $parent) {
234 234
 		parent::__construct($parent);
235 235
 		if (is_null($this->_DBHandle)) {
236
-			$this->_TableName = str_replace('.','_',$this->_getUniqueID());
236
+			$this->_TableName = str_replace('.', '_', $this->_getUniqueID());
237 237
 			$_DBName = ':memory:';
238 238
 
239 239
 			$this->_DBHandle = new SQLiteDatabase($_DBName);
240 240
 			if ($this->_DBHandle === false)
241 241
 				throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
242
-			if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
242
+			if ( ! $this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
243 243
 				throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
244 244
 		}
245 245
 	}	//	function __construct()
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @return	boolean
261 261
 	 */
262 262
 	public static function cacheMethodIsAvailable() {
263
-		if (!function_exists('sqlite_open')) {
263
+		if ( ! function_exists('sqlite_open')) {
264 264
 			return false;
265 265
 		}
266 266
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -60,8 +60,9 @@  discard block
 block discarded – undo
60 60
 		if ($this->_currentCellIsDirty) {
61 61
 			$this->_currentObject->detach();
62 62
 
63
-			if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')"))
64
-				throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
63
+			if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) {
64
+							throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
65
+			}
65 66
 			$this->_currentCellIsDirty = false;
66 67
 		}
67 68
 		$this->_currentObjectID = $this->_currentObject = null;
@@ -162,8 +163,9 @@  discard block
 block discarded – undo
162 163
 
163 164
 		//	Check if the requested entry exists in the cache
164 165
 		$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
165
-		if (!$this->_DBHandle->queryExec($query))
166
-			throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
166
+		if (!$this->_DBHandle->queryExec($query)) {
167
+					throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
168
+		}
167 169
 
168 170
 		$this->_currentCellIsDirty = false;
169 171
 	}	//	function deleteCacheData()
@@ -177,8 +179,9 @@  discard block
 block discarded – undo
177 179
 	public function getCellList() {
178 180
 		$query = "SELECT id FROM kvp_".$this->_TableName;
179 181
 		$cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC);
180
-		if ($cellIdsResult === false)
181
-			throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
182
+		if ($cellIdsResult === false) {
183
+					throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
184
+		}
182 185
 
183 186
 		$cellKeys = array();
184 187
 		foreach($cellIdsResult as $row) {
@@ -199,8 +202,9 @@  discard block
 block discarded – undo
199 202
 		//	Get a new id for the new table name
200 203
 		$tableName = str_replace('.','_',$this->_getUniqueID());
201 204
 		if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
202
-													AS SELECT * FROM kvp_'.$this->_TableName))
203
-			throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
205
+													AS SELECT * FROM kvp_'.$this->_TableName)) {
206
+					throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
207
+		}
204 208
 
205 209
 		//	Copy the existing cell cache file
206 210
 		$this->_TableName = $tableName;
@@ -237,10 +241,12 @@  discard block
 block discarded – undo
237 241
 			$_DBName = ':memory:';
238 242
 
239 243
 			$this->_DBHandle = new SQLiteDatabase($_DBName);
240
-			if ($this->_DBHandle === false)
241
-				throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
242
-			if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
243
-				throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
244
+			if ($this->_DBHandle === false) {
245
+							throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
246
+			}
247
+			if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
248
+							throw new Exception(sqlite_error_string($this->_DBHandle->lastError()));
249
+			}
244 250
 		}
245 251
 	}	//	function __construct()
246 252
 
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/CachedObjectStorage/SQLite3.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
      *
78 78
      * @param	string			$pCoord		Coordinate address of the cell to update
79 79
      * @param	PHPExcel_Cell	$cell		Cell to update
80
-	 * @return	void
80
+	 * @return	PHPExcel_Cell
81 81
      * @throws	Exception
82 82
      */
83 83
 	public function addCacheData($pCoord, PHPExcel_Cell $cell) {
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	private $_DBHandle = null;
51 51
 
52
-    /**
53
-     * Store cell data in cache for the current cell object if it's "dirty",
54
-     *     and the 'nullify' the current cell object
55
-     *
52
+	/**
53
+	 * Store cell data in cache for the current cell object if it's "dirty",
54
+	 *     and the 'nullify' the current cell object
55
+	 *
56 56
 	 * @return	void
57
-     * @throws	Exception
58
-     */
57
+	 * @throws	Exception
58
+	 */
59 59
 	private function _storeData() {
60 60
 		if ($this->_currentCellIsDirty) {
61 61
 			$this->_currentObject->detach();
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
 	}	//	function _storeData()
73 73
 
74 74
 
75
-    /**
76
-     * Add or Update a cell in cache identified by coordinate address
77
-     *
78
-     * @param	string			$pCoord		Coordinate address of the cell to update
79
-     * @param	PHPExcel_Cell	$cell		Cell to update
75
+	/**
76
+	 * Add or Update a cell in cache identified by coordinate address
77
+	 *
78
+	 * @param	string			$pCoord		Coordinate address of the cell to update
79
+	 * @param	PHPExcel_Cell	$cell		Cell to update
80 80
 	 * @return	void
81
-     * @throws	Exception
82
-     */
81
+	 * @throws	Exception
82
+	 */
83 83
 	public function addCacheData($pCoord, PHPExcel_Cell $cell) {
84 84
 		if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
85 85
 			$this->_storeData();
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	}	//	function addCacheData()
94 94
 
95 95
 
96
-    /**
97
-     * Get cell at a specific coordinate
98
-     *
99
-     * @param 	string 			$pCoord		Coordinate of the cell
100
-     * @throws 	Exception
101
-     * @return 	PHPExcel_Cell 	Cell that was found, or null if not found
102
-     */
96
+	/**
97
+	 * Get cell at a specific coordinate
98
+	 *
99
+	 * @param 	string 			$pCoord		Coordinate of the cell
100
+	 * @throws 	Exception
101
+	 * @return 	PHPExcel_Cell 	Cell that was found, or null if not found
102
+	 */
103 103
 	public function getCacheData($pCoord) {
104 104
 		if ($pCoord === $this->_currentObjectID) {
105 105
 			return $this->_currentObject;
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 	}	//	function isDataSet()
152 152
 
153 153
 
154
-    /**
155
-     *	Delete a cell in cache identified by coordinate address
156
-     *
157
-     * @param	string			$pCoord		Coordinate address of the cell to delete
158
-     * @throws	Exception
159
-     */
154
+	/**
155
+	 *	Delete a cell in cache identified by coordinate address
156
+	 *
157
+	 * @param	string			$pCoord		Coordinate address of the cell to delete
158
+	 * @throws	Exception
159
+	 */
160 160
 	public function deleteCacheData($pCoord) {
161 161
 		if ($pCoord === $this->_currentObjectID) {
162 162
 			$this->_currentObject->detach();
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 			$this->_currentObject->detach();
62 62
 
63 63
 			$query = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)");
64
-			$query->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT);
65
-			$query->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB);
64
+			$query->bindValue('id', $this->_currentObjectID, SQLITE3_TEXT);
65
+			$query->bindValue('data', serialize($this->_currentObject), SQLITE3_BLOB);
66 66
 			$result = $query->execute();
67 67
 			if ($result === false)
68 68
 				throw new Exception($this->_DBHandle->lastErrorMsg());
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	public function copyCellCollection(PHPExcel_Worksheet $parent) {
203 203
 		//	Get a new id for the new table name
204
-		$tableName = str_replace('.','_',$this->_getUniqueID());
205
-		if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
204
+		$tableName = str_replace('.', '_', $this->_getUniqueID());
205
+		if ( ! $this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
206 206
 		                                       AS SELECT * FROM kvp_'.$this->_TableName))
207 207
 			throw new Exception($this->_DBHandle->lastErrorMsg());
208 208
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @return	void
218 218
 	 */
219 219
 	public function unsetWorksheetCells() {
220
-		if(!is_null($this->_currentObject)) {
220
+		if ( ! is_null($this->_currentObject)) {
221 221
 			$this->_currentObject->detach();
222 222
 			$this->_currentObject = $this->_currentObjectID = null;
223 223
 		}
@@ -237,13 +237,13 @@  discard block
 block discarded – undo
237 237
 	public function __construct(PHPExcel_Worksheet $parent) {
238 238
 		parent::__construct($parent);
239 239
 		if (is_null($this->_DBHandle)) {
240
-			$this->_TableName = str_replace('.','_',$this->_getUniqueID());
240
+			$this->_TableName = str_replace('.', '_', $this->_getUniqueID());
241 241
 			$_DBName = ':memory:';
242 242
 
243 243
 			$this->_DBHandle = new SQLite3($_DBName);
244 244
 			if ($this->_DBHandle === false)
245 245
 				throw new Exception($this->_DBHandle->lastErrorMsg());
246
-			if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
246
+			if ( ! $this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
247 247
 				throw new Exception($this->_DBHandle->lastErrorMsg());
248 248
 		}
249 249
 	}	//	function __construct()
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * Destroy this cell collection
254 254
 	 */
255 255
 	public function __destruct() {
256
-		if (!is_null($this->_DBHandle)) {
256
+		if ( ! is_null($this->_DBHandle)) {
257 257
 			$this->_DBHandle->close();
258 258
 		}
259 259
 		$this->_DBHandle = null;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 * @return	boolean
268 268
 	 */
269 269
 	public static function cacheMethodIsAvailable() {
270
-		if (!class_exists('SQLite3')) {
270
+		if ( ! class_exists('SQLite3')) {
271 271
 			return false;
272 272
 		}
273 273
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -64,8 +64,9 @@  discard block
 block discarded – undo
64 64
 			$query->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT);
65 65
 			$query->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB);
66 66
 			$result = $query->execute();
67
-			if ($result === false)
68
-				throw new Exception($this->_DBHandle->lastErrorMsg());
67
+			if ($result === false) {
68
+							throw new Exception($this->_DBHandle->lastErrorMsg());
69
+			}
69 70
 			$this->_currentCellIsDirty = false;
70 71
 		}
71 72
 		$this->_currentObjectID = $this->_currentObject = null;
@@ -166,8 +167,9 @@  discard block
 block discarded – undo
166 167
 		//	Check if the requested entry exists in the cache
167 168
 		$query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'";
168 169
 		$result = $this->_DBHandle->exec($query);
169
-		if ($result === false)
170
-			throw new Exception($this->_DBHandle->lastErrorMsg());
170
+		if ($result === false) {
171
+					throw new Exception($this->_DBHandle->lastErrorMsg());
172
+		}
171 173
 
172 174
 		$this->_currentCellIsDirty = false;
173 175
 	}	//	function deleteCacheData()
@@ -181,8 +183,9 @@  discard block
 block discarded – undo
181 183
 	public function getCellList() {
182 184
 		$query = "SELECT id FROM kvp_".$this->_TableName;
183 185
 		$cellIdsResult = $this->_DBHandle->query($query);
184
-		if ($cellIdsResult === false)
185
-			throw new Exception($this->_DBHandle->lastErrorMsg());
186
+		if ($cellIdsResult === false) {
187
+					throw new Exception($this->_DBHandle->lastErrorMsg());
188
+		}
186 189
 
187 190
 		$cellKeys = array();
188 191
 		while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) {
@@ -203,8 +206,9 @@  discard block
 block discarded – undo
203 206
 		//	Get a new id for the new table name
204 207
 		$tableName = str_replace('.','_',$this->_getUniqueID());
205 208
 		if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
206
-		                                       AS SELECT * FROM kvp_'.$this->_TableName))
207
-			throw new Exception($this->_DBHandle->lastErrorMsg());
209
+		                                       AS SELECT * FROM kvp_'.$this->_TableName)) {
210
+					throw new Exception($this->_DBHandle->lastErrorMsg());
211
+		}
208 212
 
209 213
 		//	Copy the existing cell cache file
210 214
 		$this->_TableName = $tableName;
@@ -241,10 +245,12 @@  discard block
 block discarded – undo
241 245
 			$_DBName = ':memory:';
242 246
 
243 247
 			$this->_DBHandle = new SQLite3($_DBName);
244
-			if ($this->_DBHandle === false)
245
-				throw new Exception($this->_DBHandle->lastErrorMsg());
246
-			if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
247
-				throw new Exception($this->_DBHandle->lastErrorMsg());
248
+			if ($this->_DBHandle === false) {
249
+							throw new Exception($this->_DBHandle->lastErrorMsg());
250
+			}
251
+			if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
252
+							throw new Exception($this->_DBHandle->lastErrorMsg());
253
+			}
248 254
 		}
249 255
 	}	//	function __construct()
250 256
 
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/CachedObjectStorage/Wincache.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
 	 *
86 86
 	 * @param	string			$pCoord		Coordinate address of the cell to update
87 87
 	 * @param	PHPExcel_Cell	$cell		Cell to update
88
-	 * @return	void
88
+	 * @return	PHPExcel_Cell
89 89
 	 * @throws	Exception
90 90
 	 */
91 91
 	public function addCacheData($pCoord, PHPExcel_Cell $cell) {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,13 +50,13 @@
 block discarded – undo
50 50
 	private $_cacheTime = 600;
51 51
 
52 52
 
53
-    /**
54
-     * Store cell data in cache for the current cell object if it's "dirty",
55
-     *     and the 'nullify' the current cell object
56
-     *
53
+	/**
54
+	 * Store cell data in cache for the current cell object if it's "dirty",
55
+	 *     and the 'nullify' the current cell object
56
+	 *
57 57
 	 * @return	void
58
-     * @throws	Exception
59
-     */
58
+	 * @throws	Exception
59
+	 */
60 60
 	private function _storeData() {
61 61
 		if ($this->_currentCellIsDirty) {
62 62
 			$this->_currentObject->detach();
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 
64 64
 			$obj = serialize($this->_currentObject);
65 65
 			if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) {
66
-				if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
66
+				if ( ! wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
67 67
 					$this->__destruct();
68 68
 					throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
69 69
 				}
70 70
 			} else {
71
-				if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
71
+				if ( ! wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
72 72
 					$this->__destruct();
73 73
 					throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
74 74
 				}
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 		parent::copyCellCollection($parent);
192 192
 		//	Get a new id for the new file name
193 193
 		$baseUnique = $this->_getUniqueID();
194
-		$newCachePrefix = substr(md5($baseUnique),0,8).'.';
194
+		$newCachePrefix = substr(md5($baseUnique), 0, 8).'.';
195 195
 		$cacheList = $this->getCellList();
196
-		foreach($cacheList as $cellID) {
196
+		foreach ($cacheList as $cellID) {
197 197
 			if ($cellID != $this->_currentObjectID) {
198 198
 				$success = false;
199 199
 				$obj = wincache_ucache_get($this->_cachePrefix.$cellID.'.cache', $success);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 					parent::deleteCacheData($cellID);
203 203
 					throw new Exception('Cell entry '.$cellID.' no longer exists in Wincache');
204 204
 				}
205
-				if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) {
205
+				if ( ! wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) {
206 206
 					$this->__destruct();
207 207
 					throw new Exception('Failed to store cell '.$cellID.' in Wincache');
208 208
 				}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return	void
219 219
 	 */
220 220
 	public function unsetWorksheetCells() {
221
-		if(!is_null($this->_currentObject)) {
221
+		if ( ! is_null($this->_currentObject)) {
222 222
 			$this->_currentObject->detach();
223 223
 			$this->_currentObject = $this->_currentObjectID = null;
224 224
 		}
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
 	 * @param	array of mixed		$arguments	Additional initialisation arguments
241 241
 	 */
242 242
 	public function __construct(PHPExcel_Worksheet $parent, $arguments) {
243
-		$cacheTime	= (isset($arguments['cacheTime']))	? $arguments['cacheTime']	: 600;
243
+		$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
244 244
 
245 245
 		if (is_null($this->_cachePrefix)) {
246 246
 			$baseUnique = $this->_getUniqueID();
247
-			$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
247
+			$this->_cachePrefix = substr(md5($baseUnique), 0, 8).'.';
248 248
 			$this->_cacheTime = $cacheTime;
249 249
 
250 250
 			parent::__construct($parent);
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	public function __destruct() {
259 259
 		$cacheList = $this->getCellList();
260
-		foreach($cacheList as $cellID) {
260
+		foreach ($cacheList as $cellID) {
261 261
 			wincache_ucache_delete($this->_cachePrefix.$cellID.'.cache');
262 262
 		}
263 263
 	}	//	function __destruct()
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * @return	boolean
271 271
 	 */
272 272
 	public static function cacheMethodIsAvailable() {
273
-		if (!function_exists('wincache_ucache_add')) {
273
+		if ( ! function_exists('wincache_ucache_add')) {
274 274
 			return false;
275 275
 		}
276 276
 
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/CachedObjectStorageFactory.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@
 block discarded – undo
142 142
 	/**
143 143
 	 * Return the current cache storage class
144 144
 	 *
145
-	 * @return PHPExcel_CachedObjectStorage_ICache|NULL
145
+	 * @return string|null
146 146
 	 **/
147 147
 	public static function getCacheStorageClass()
148 148
 	{
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
  */
37 37
 class PHPExcel_CachedObjectStorageFactory
38 38
 {
39
-	const cache_in_memory				= 'Memory';
40
-	const cache_in_memory_gzip			= 'MemoryGZip';
41
-	const cache_in_memory_serialized	= 'MemorySerialized';
42
-	const cache_igbinary				= 'Igbinary';
39
+	const cache_in_memory = 'Memory';
40
+	const cache_in_memory_gzip = 'MemoryGZip';
41
+	const cache_in_memory_serialized = 'MemorySerialized';
42
+	const cache_igbinary = 'Igbinary';
43 43
 	const cache_to_discISAM				= 'DiscISAM';
44
-	const cache_to_apc					= 'APC';
44
+	const cache_to_apc = 'APC';
45 45
 	const cache_to_memcache				= 'Memcache';
46 46
 	const cache_to_phpTemp				= 'PHPTemp';
47 47
 	const cache_to_wincache				= 'Wincache';
48
-	const cache_to_sqlite				= 'SQLite';
48
+	const cache_to_sqlite = 'SQLite';
49 49
 	const cache_to_sqlite3				= 'SQLite3';
50 50
 
51 51
 
@@ -98,17 +98,17 @@  discard block
 block discarded – undo
98 98
 													),
99 99
 		self::cache_igbinary				=> array(
100 100
 													),
101
-		self::cache_to_phpTemp				=> array( 'memoryCacheSize'	=> '1MB'
101
+		self::cache_to_phpTemp				=> array('memoryCacheSize'	=> '1MB'
102 102
 													),
103
-		self::cache_to_discISAM				=> array( 'dir'				=> NULL
103
+		self::cache_to_discISAM				=> array('dir'				=> NULL
104 104
 													),
105
-		self::cache_to_apc					=> array( 'cacheTime'		=> 600
105
+		self::cache_to_apc					=> array('cacheTime'		=> 600
106 106
 													),
107
-		self::cache_to_memcache				=> array( 'memcacheServer'	=> 'localhost',
107
+		self::cache_to_memcache				=> array('memcacheServer'	=> 'localhost',
108 108
 													  'memcachePort'	=> 11211,
109 109
 													  'cacheTime'		=> 600
110 110
 													),
111
-		self::cache_to_wincache				=> array( 'cacheTime'		=> 600
111
+		self::cache_to_wincache				=> array('cacheTime'		=> 600
112 112
 													),
113 113
 		self::cache_to_sqlite				=> array(
114 114
 													),
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	public static function getCacheStorageMethods()
173 173
 	{
174 174
 		$activeMethods = array();
175
-		foreach(self::$_storageMethods as $storageMethod) {
176
-			$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod;
175
+		foreach (self::$_storageMethods as $storageMethod) {
176
+			$cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$storageMethod;
177 177
 			if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) {
178 178
 				$activeMethods[] = $storageMethod;
179 179
 			}
@@ -192,25 +192,25 @@  discard block
 block discarded – undo
192 192
 	 **/
193 193
 	public static function initialize($method = self::cache_in_memory, $arguments = array())
194 194
 	{
195
-		if (!in_array($method,self::$_storageMethods)) {
195
+		if ( ! in_array($method, self::$_storageMethods)) {
196 196
 			return FALSE;
197 197
 		}
198 198
 
199 199
 		$cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
200
-		if (!call_user_func(array( $cacheStorageClass,
200
+		if ( ! call_user_func(array($cacheStorageClass,
201 201
 								   'cacheMethodIsAvailable'))) {
202 202
 			return FALSE;
203 203
 		}
204 204
 
205 205
 		self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method];
206
-		foreach($arguments as $k => $v) {
206
+		foreach ($arguments as $k => $v) {
207 207
 			if (isset(self::$_storageMethodParameters[$method][$k])) {
208 208
 				self::$_storageMethodParameters[$method][$k] = $v;
209 209
 			}
210 210
 		}
211 211
 
212 212
 		if (self::$_cacheStorageMethod === NULL) {
213
-			self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
213
+			self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
214 214
 			self::$_cacheStorageMethod = $method;
215 215
 		}
216 216
 		return TRUE;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		}
232 232
 
233 233
 		if ($cacheMethodIsAvailable) {
234
-			$instance = new self::$_cacheStorageClass( $parent,
234
+			$instance = new self::$_cacheStorageClass($parent,
235 235
 													   self::$_storageMethodParameters[self::$_cacheStorageMethod]
236 236
 													 );
237 237
 			if ($instance !== NULL) {
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Calculation.php 3 patches
Doc Comments   +32 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 	/**
1853 1853
 	 * Set calculation cache expiration time
1854 1854
 	 *
1855
-	 * @param float $pValue
1855
+	 * @param integer $pValue
1856 1856
 	 */
1857 1857
 	public function setCalculationCacheExpirationTime($pValue = 15) {
1858 1858
 		self::$_calculationCacheExpirationTime = $pValue;
@@ -1966,6 +1966,10 @@  discard block
 block discarded – undo
1966 1966
 		return $formula;
1967 1967
 	}
1968 1968
 
1969
+	/**
1970
+	 * @param string $fromSeparator
1971
+	 * @param string $toSeparator
1972
+	 */
1969 1973
 	private static function _translateFormula($from,$to,$formula,$fromSeparator,$toSeparator) {
1970 1974
 		//	Convert any Excel function names to the required language
1971 1975
 		if (self::$_localeLanguage !== 'en_us') {
@@ -2386,7 +2390,7 @@  discard block
 block discarded – undo
2386 2390
 	 * Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0
2387 2391
 	 *
2388 2392
 	 * @param	mixed		&$matrix		matrix operand
2389
-	 * @return	array		An array comprising the number of rows, and number of columns
2393
+	 * @return	integer[]		An array comprising the number of rows, and number of columns
2390 2394
 	 */
2391 2395
 	public static function _getMatrixDimensions(&$matrix) {
2392 2396
 		$matrixRows = count($matrix);
@@ -2409,6 +2413,10 @@  discard block
 block discarded – undo
2409 2413
 	 *
2410 2414
 	 * @param	mixed		&$matrix1	First matrix operand
2411 2415
 	 * @param	mixed		&$matrix2	Second matrix operand
2416
+	 * @param integer $matrix1Rows
2417
+	 * @param integer $matrix1Columns
2418
+	 * @param integer $matrix2Rows
2419
+	 * @param integer $matrix2Columns
2412 2420
 	 */
2413 2421
 	private static function _resizeMatricesShrink(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) {
2414 2422
 		if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
@@ -2448,6 +2456,10 @@  discard block
 block discarded – undo
2448 2456
 	 *
2449 2457
 	 * @param	mixed		&$matrix1	First matrix operand
2450 2458
 	 * @param	mixed		&$matrix2	Second matrix operand
2459
+	 * @param integer $matrix1Rows
2460
+	 * @param integer $matrix1Columns
2461
+	 * @param integer $matrix2Rows
2462
+	 * @param integer $matrix2Columns
2451 2463
 	 */
2452 2464
 	private static function _resizeMatricesExtend(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) {
2453 2465
 		if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
@@ -2525,7 +2537,7 @@  discard block
 block discarded – undo
2525 2537
 	 * Format type and details of an operand for display in the log (based on operand type)
2526 2538
 	 *
2527 2539
 	 * @param	mixed		$value	First matrix operand
2528
-	 * @return	mixed
2540
+	 * @return	string|null
2529 2541
 	 */
2530 2542
 	private function _showTypeDetails($value) {
2531 2543
 		if ($this->writeDebugLog) {
@@ -2558,6 +2570,9 @@  discard block
 block discarded – undo
2558 2570
 	}	//	function _showTypeDetails()
2559 2571
 
2560 2572
 
2573
+	/**
2574
+	 * @param string $formula
2575
+	 */
2561 2576
 	private static function _convertMatrixReferences($formula) {
2562 2577
 		static $matrixReplaceFrom = array('{',';','}');
2563 2578
 		static $matrixReplaceTo = array('MKMATRIX(MKMATRIX(','),MKMATRIX(','))');
@@ -2615,6 +2630,10 @@  discard block
 block discarded – undo
2615 2630
 
2616 2631
 
2617 2632
 	// Convert infix to postfix notation
2633
+
2634
+	/**
2635
+	 * @param string $formula
2636
+	 */
2618 2637
 	private function _parseFormula($formula, PHPExcel_Cell $pCell = null) {
2619 2638
 		if (($formula = self::_convertMatrixReferences(trim($formula))) === false) {
2620 2639
 			return FALSE;
@@ -3001,6 +3020,10 @@  discard block
 block discarded – undo
3001 3020
 	}
3002 3021
 
3003 3022
 	// evaluate postfix notation
3023
+
3024
+	/**
3025
+	 * @param string $cellID
3026
+	 */
3004 3027
 	private function _processTokenStack($tokens, $cellID = null, PHPExcel_Cell $pCell = null) {
3005 3028
 		if ($tokens == false) return false;
3006 3029
 
@@ -3500,6 +3523,9 @@  discard block
 block discarded – undo
3500 3523
 	}	//	function _executeBinaryComparisonOperation()
3501 3524
 
3502 3525
 
3526
+	/**
3527
+	 * @param string $matrixFunction
3528
+	 */
3503 3529
 	private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
3504 3530
 		//	Validate the two operands
3505 3531
 		if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return false;
@@ -3580,6 +3606,9 @@  discard block
 block discarded – undo
3580 3606
 	}	//	function _executeNumericBinaryOperation()
3581 3607
 
3582 3608
 
3609
+	/**
3610
+	 * @param string $message
3611
+	 */
3583 3612
 	private function _writeDebug($message) {
3584 3613
 		//	Only write the debug log if logging is enabled
3585 3614
 		if ($this->writeDebugLog) {
Please login to merge, or discard this patch.
Spacing   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -27,27 +27,27 @@  discard block
 block discarded – undo
27 27
 
28 28
 
29 29
 /** PHPExcel root directory */
30
-if (!defined('PHPEXCEL_ROOT')) {
30
+if ( ! defined('PHPEXCEL_ROOT')) {
31 31
 	/**
32 32
 	 * @ignore
33 33
 	 */
34
-	define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
35
-	require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
34
+	define('PHPEXCEL_ROOT', dirname(__FILE__).'/../');
35
+	require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php');
36 36
 }
37 37
 
38 38
 
39
-if (!defined('CALCULATION_REGEXP_CELLREF')) {
39
+if ( ! defined('CALCULATION_REGEXP_CELLREF')) {
40 40
 	//	Test for support of \P (multibyte options) in PCRE
41
-	if(defined('PREG_BAD_UTF8_ERROR')) {
41
+	if (defined('PREG_BAD_UTF8_ERROR')) {
42 42
 		//	Cell reference (cell or range of cells, with or without a sheet reference)
43
-		define('CALCULATION_REGEXP_CELLREF','((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})');
43
+		define('CALCULATION_REGEXP_CELLREF', '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})');
44 44
 		//	Named Range of cells
45
-		define('CALCULATION_REGEXP_NAMEDRANGE','((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?([_A-Z][_A-Z0-9\.]*)');
45
+		define('CALCULATION_REGEXP_NAMEDRANGE', '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?([_A-Z][_A-Z0-9\.]*)');
46 46
 	} else {
47 47
 		//	Cell reference (cell or range of cells, with or without a sheet reference)
48
-		define('CALCULATION_REGEXP_CELLREF','(((\w*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d+)');
48
+		define('CALCULATION_REGEXP_CELLREF', '(((\w*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d+)');
49 49
 		//	Named Range of cells
50
-		define('CALCULATION_REGEXP_NAMEDRANGE','(((\w*)|(\'.*\')|(\".*\"))!)?([_A-Z][_A-Z0-9\.]*)');
50
+		define('CALCULATION_REGEXP_NAMEDRANGE', '(((\w*)|(\'.*\')|(\".*\"))!)?([_A-Z][_A-Z0-9\.]*)');
51 51
 	}
52 52
 }
53 53
 
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
 	//	String operand
69 69
 	const CALCULATION_REGEXP_STRING		= '"(?:[^"]|"")*"';
70 70
 	//	Opening bracket
71
-	const CALCULATION_REGEXP_OPENBRACE	= '\(';
71
+	const CALCULATION_REGEXP_OPENBRACE = '\(';
72 72
 	//	Function (allow for the old @ symbol that could be used to prefix a function, but we'll ignore it)
73
-	const CALCULATION_REGEXP_FUNCTION	= '@?([A-Z][A-Z0-9\.]*)[\s]*\(';
73
+	const CALCULATION_REGEXP_FUNCTION = '@?([A-Z][A-Z0-9\.]*)[\s]*\(';
74 74
 	//	Cell reference (cell or range of cells, with or without a sheet reference)
75
-	const CALCULATION_REGEXP_CELLREF	= CALCULATION_REGEXP_CELLREF;
75
+	const CALCULATION_REGEXP_CELLREF = CALCULATION_REGEXP_CELLREF;
76 76
 	//	Named Range of cells
77
-	const CALCULATION_REGEXP_NAMEDRANGE	= CALCULATION_REGEXP_NAMEDRANGE;
77
+	const CALCULATION_REGEXP_NAMEDRANGE = CALCULATION_REGEXP_NAMEDRANGE;
78 78
 	//	Error
79
-	const CALCULATION_REGEXP_ERROR		= '\#[A-Z][A-Z0_\/]*[!\?]?';
79
+	const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?';
80 80
 
81 81
 
82 82
 	/** constants */
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	const RETURN_ARRAY_AS_VALUE = 'value';
85 85
 	const RETURN_ARRAY_AS_ARRAY = 'array';
86 86
 
87
-	private static $returnArrayAsType	= self::RETURN_ARRAY_AS_VALUE;
87
+	private static $returnArrayAsType = self::RETURN_ARRAY_AS_VALUE;
88 88
 
89 89
 
90 90
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @access	private
103 103
 	 * @var array
104 104
 	 */
105
-	private static $_calculationCache = array ();
105
+	private static $_calculationCache = array();
106 106
 
107 107
 
108 108
 	/**
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	 * @access	private
131 131
 	 * @var array
132 132
 	 */
133
-	private static $_operators			= array('+' => true,	'-' => true,	'*' => true,	'/' => true,
134
-												'^' => true,	'&' => true,	'%' => false,	'~' => false,
135
-												'>' => true,	'<' => true,	'=' => true,	'>=' => true,
136
-												'<=' => true,	'<>' => true,	'|' => true,	':' => true
133
+	private static $_operators = array('+' => true, '-' => true, '*' => true, '/' => true,
134
+												'^' => true, '&' => true, '%' => false, '~' => false,
135
+												'>' => true, '<' => true, '=' => true, '>=' => true,
136
+												'<=' => true, '<>' => true, '|' => true, ':' => true
137 137
 											   );
138 138
 
139 139
 
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 	 * @access	private
144 144
 	 * @var array
145 145
 	 */
146
-	private static $_binaryOperators	= array('+' => true,	'-' => true,	'*' => true,	'/' => true,
147
-												'^' => true,	'&' => true,	'>' => true,	'<' => true,
148
-												'=' => true,	'>=' => true,	'<=' => true,	'<>' => true,
149
-												'|' => true,	':' => true
146
+	private static $_binaryOperators = array('+' => true, '-' => true, '*' => true, '/' => true,
147
+												'^' => true, '&' => true, '>' => true, '<' => true,
148
+												'=' => true, '>=' => true, '<=' => true, '<>' => true,
149
+												'|' => true, ':' => true
150 150
 											   );
151 151
 
152 152
 	/**
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 	public $cyclicFormulaCount = 0;
216 216
 
217 217
 
218
-	private $_savedPrecision	= 12;
218
+	private $_savedPrecision = 12;
219 219
 
220 220
 
221
-	private static $_localeLanguage = 'en_us';					//	US English	(default locale)
222
-	private static $_validLocaleLanguages = array(	'en'		//	English		(default language)
221
+	private static $_localeLanguage = 'en_us'; //	US English	(default locale)
222
+	private static $_validLocaleLanguages = array('en'		//	English		(default language)
223 223
 												 );
224 224
 	private static $_localeArgumentSeparator = ',';
225 225
 	private static $_localeFunctions = array();
226
-	public static $_localeBoolean = array(	'TRUE'	=> 'TRUE',
226
+	public static $_localeBoolean = array('TRUE'	=> 'TRUE',
227 227
 											'FALSE'	=> 'FALSE',
228 228
 											'NULL'	=> 'NULL'
229 229
 										  );
@@ -1682,8 +1682,8 @@  discard block
 block discarded – undo
1682 1682
 
1683 1683
 	private function __construct() {
1684 1684
 		$localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/';
1685
-		foreach (glob($localeFileDirectory.'/*',GLOB_ONLYDIR) as $filename) {
1686
-			$filename = substr($filename,strlen($localeFileDirectory)+1);
1685
+		foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) {
1686
+			$filename = substr($filename, strlen($localeFileDirectory) + 1);
1687 1687
 			if ($filename != 'en') {
1688 1688
 				self::$_validLocaleLanguages[] = $filename;
1689 1689
 			}
@@ -1692,14 +1692,14 @@  discard block
 block discarded – undo
1692 1692
 		$setPrecision = (PHP_INT_SIZE == 4) ? 12 : 16;
1693 1693
 		$this->_savedPrecision = ini_get('precision');
1694 1694
 		if ($this->_savedPrecision < $setPrecision) {
1695
-			ini_set('precision',$setPrecision);
1695
+			ini_set('precision', $setPrecision);
1696 1696
 		}
1697 1697
 	}	//	function __construct()
1698 1698
 
1699 1699
 
1700 1700
 	public function __destruct() {
1701 1701
 		if ($this->_savedPrecision != ini_get('precision')) {
1702
-			ini_set('precision',$this->_savedPrecision);
1702
+			ini_set('precision', $this->_savedPrecision);
1703 1703
 		}
1704 1704
 	}
1705 1705
 
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 	 * @return PHPExcel_Calculation
1711 1711
 	 */
1712 1712
 	public static function getInstance() {
1713
-		if (!isset(self::$_instance) || (self::$_instance === NULL)) {
1713
+		if ( ! isset(self::$_instance) || (self::$_instance === NULL)) {
1714 1714
 			self::$_instance = new PHPExcel_Calculation();
1715 1715
 		}
1716 1716
 
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
 	 * @throws	Exception
1740 1740
 	 */
1741 1741
 	public final function __clone() {
1742
-		throw new Exception ('Cloning a Singleton is not allowed!');
1742
+		throw new Exception('Cloning a Singleton is not allowed!');
1743 1743
 	}	//	function __clone()
1744 1744
 
1745 1745
 
@@ -1876,15 +1876,15 @@  discard block
 block discarded – undo
1876 1876
 	 *
1877 1877
 	 * @return boolean
1878 1878
 	 */
1879
-	public function setLocale($locale='en_us') {
1879
+	public function setLocale($locale = 'en_us') {
1880 1880
 		//	Identify our locale and language
1881 1881
 		$language = $locale = strtolower($locale);
1882
-		if (strpos($locale,'_') !== false) {
1883
-			list($language) = explode('_',$locale);
1882
+		if (strpos($locale, '_') !== false) {
1883
+			list($language) = explode('_', $locale);
1884 1884
 		}
1885 1885
 
1886 1886
 		//	Test whether we have any language data for this language (any locale)
1887
-		if (in_array($language,self::$_validLocaleLanguages)) {
1887
+		if (in_array($language, self::$_validLocaleLanguages)) {
1888 1888
 			//	initialise language/locale settings
1889 1889
 			self::$_localeFunctions = array();
1890 1890
 			self::$_localeArgumentSeparator = ',';
@@ -1892,20 +1892,20 @@  discard block
 block discarded – undo
1892 1892
 			//	Default is English, if user isn't requesting english, then read the necessary data from the locale files
1893 1893
 			if ($locale != 'en_us') {
1894 1894
 				//	Search for a file with a list of function names for locale
1895
-				$functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_',DIRECTORY_SEPARATOR,$locale).DIRECTORY_SEPARATOR.'functions';
1896
-				if (!file_exists($functionNamesFile)) {
1895
+				$functionNamesFile = PHPEXCEL_ROOT.'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'functions';
1896
+				if ( ! file_exists($functionNamesFile)) {
1897 1897
 					//	If there isn't a locale specific function file, look for a language specific function file
1898
-					$functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'functions';
1899
-					if (!file_exists($functionNamesFile)) {
1898
+					$functionNamesFile = PHPEXCEL_ROOT.'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'functions';
1899
+					if ( ! file_exists($functionNamesFile)) {
1900 1900
 						return false;
1901 1901
 					}
1902 1902
 				}
1903 1903
 				//	Retrieve the list of locale or language specific function names
1904
-				$localeFunctions = file($functionNamesFile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
1904
+				$localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
1905 1905
 				foreach ($localeFunctions as $localeFunction) {
1906
-					list($localeFunction) = explode('##',$localeFunction);	//	Strip out comments
1907
-					if (strpos($localeFunction,'=') !== false) {
1908
-						list($fName,$lfName) = explode('=',$localeFunction);
1906
+					list($localeFunction) = explode('##', $localeFunction); //	Strip out comments
1907
+					if (strpos($localeFunction, '=') !== false) {
1908
+						list($fName, $lfName) = explode('=', $localeFunction);
1909 1909
 						$fName = trim($fName);
1910 1910
 						$lfName = trim($lfName);
1911 1911
 						if ((isset(self::$_PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
@@ -1917,16 +1917,16 @@  discard block
 block discarded – undo
1917 1917
 				if (isset(self::$_localeFunctions['TRUE'])) { self::$_localeBoolean['TRUE'] = self::$_localeFunctions['TRUE']; }
1918 1918
 				if (isset(self::$_localeFunctions['FALSE'])) { self::$_localeBoolean['FALSE'] = self::$_localeFunctions['FALSE']; }
1919 1919
 
1920
-				$configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_',DIRECTORY_SEPARATOR,$locale).DIRECTORY_SEPARATOR.'config';
1921
-				if (!file_exists($configFile)) {
1922
-					$configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'config';
1920
+				$configFile = PHPEXCEL_ROOT.'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'config';
1921
+				if ( ! file_exists($configFile)) {
1922
+					$configFile = PHPEXCEL_ROOT.'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'config';
1923 1923
 				}
1924 1924
 				if (file_exists($configFile)) {
1925
-					$localeSettings = file($configFile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
1925
+					$localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
1926 1926
 					foreach ($localeSettings as $localeSetting) {
1927
-						list($localeSetting) = explode('##',$localeSetting);	//	Strip out comments
1928
-						if (strpos($localeSetting,'=') !== false) {
1929
-							list($settingName,$settingValue) = explode('=',$localeSetting);
1927
+						list($localeSetting) = explode('##', $localeSetting); //	Strip out comments
1928
+						if (strpos($localeSetting, '=') !== false) {
1929
+							list($settingName, $settingValue) = explode('=', $localeSetting);
1930 1930
 							$settingName = strtoupper(trim($settingName));
1931 1931
 							switch ($settingName) {
1932 1932
 								case 'ARGUMENTSEPARATOR' :
@@ -1948,48 +1948,48 @@  discard block
 block discarded – undo
1948 1948
 
1949 1949
 
1950 1950
 
1951
-	public static function _translateSeparator($fromSeparator,$toSeparator,$formula,&$inBraces) {
1951
+	public static function _translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces) {
1952 1952
 		$strlen = mb_strlen($formula);
1953 1953
 		for ($i = 0; $i < $strlen; ++$i) {
1954
-			$chr = mb_substr($formula,$i,1);
1954
+			$chr = mb_substr($formula, $i, 1);
1955 1955
 			switch ($chr) {
1956 1956
 				case '{' :	$inBraces = true;
1957 1957
 							break;
1958 1958
 				case '}' :	$inBraces = false;
1959 1959
 							break;
1960 1960
 				case $fromSeparator :
1961
-							if (!$inBraces) {
1962
-								$formula = mb_substr($formula,0,$i).$toSeparator.mb_substr($formula,$i+1);
1961
+							if ( ! $inBraces) {
1962
+								$formula = mb_substr($formula, 0, $i).$toSeparator.mb_substr($formula, $i + 1);
1963 1963
 							}
1964 1964
 			}
1965 1965
 		}
1966 1966
 		return $formula;
1967 1967
 	}
1968 1968
 
1969
-	private static function _translateFormula($from,$to,$formula,$fromSeparator,$toSeparator) {
1969
+	private static function _translateFormula($from, $to, $formula, $fromSeparator, $toSeparator) {
1970 1970
 		//	Convert any Excel function names to the required language
1971 1971
 		if (self::$_localeLanguage !== 'en_us') {
1972 1972
 			$inBraces = false;
1973 1973
 			//	If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
1974
-			if (strpos($formula,'"') !== false) {
1974
+			if (strpos($formula, '"') !== false) {
1975 1975
 				//	So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded
1976 1976
 				//		the formula
1977
-				$temp = explode('"',$formula);
1977
+				$temp = explode('"', $formula);
1978 1978
 				$i = false;
1979
-				foreach($temp as &$value) {
1979
+				foreach ($temp as &$value) {
1980 1980
 					//	Only count/replace in alternating array entries
1981
-					if ($i = !$i) {
1982
-						$value = preg_replace($from,$to,$value);
1983
-						$value = self::_translateSeparator($fromSeparator,$toSeparator,$value,$inBraces);
1981
+					if ($i = ! $i) {
1982
+						$value = preg_replace($from, $to, $value);
1983
+						$value = self::_translateSeparator($fromSeparator, $toSeparator, $value, $inBraces);
1984 1984
 					}
1985 1985
 				}
1986 1986
 				unset($value);
1987 1987
 				//	Then rebuild the formula string
1988
-				$formula = implode('"',$temp);
1988
+				$formula = implode('"', $temp);
1989 1989
 			} else {
1990 1990
 				//	If there's no quoted strings, then we do a simple count/replace
1991
-				$formula = preg_replace($from,$to,$formula);
1992
-				$formula = self::_translateSeparator($fromSeparator,$toSeparator,$formula,$inBraces);
1991
+				$formula = preg_replace($from, $to, $formula);
1992
+				$formula = self::_translateSeparator($fromSeparator, $toSeparator, $formula, $inBraces);
1993 1993
 			}
1994 1994
 		}
1995 1995
 
@@ -2002,10 +2002,10 @@  discard block
 block discarded – undo
2002 2002
 	public function _translateFormulaToLocale($formula) {
2003 2003
 		if (self::$functionReplaceFromExcel === NULL) {
2004 2004
 			self::$functionReplaceFromExcel = array();
2005
-			foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) {
2005
+			foreach (array_keys(self::$_localeFunctions) as $excelFunctionName) {
2006 2006
 				self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui';
2007 2007
 			}
2008
-			foreach(array_keys(self::$_localeBoolean) as $excelBoolean) {
2008
+			foreach (array_keys(self::$_localeBoolean) as $excelBoolean) {
2009 2009
 				self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
2010 2010
 			}
2011 2011
 
@@ -2013,49 +2013,49 @@  discard block
 block discarded – undo
2013 2013
 
2014 2014
 		if (self::$functionReplaceToLocale === NULL) {
2015 2015
 			self::$functionReplaceToLocale = array();
2016
-			foreach(array_values(self::$_localeFunctions) as $localeFunctionName) {
2016
+			foreach (array_values(self::$_localeFunctions) as $localeFunctionName) {
2017 2017
 				self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2';
2018 2018
 			}
2019
-			foreach(array_values(self::$_localeBoolean) as $localeBoolean) {
2019
+			foreach (array_values(self::$_localeBoolean) as $localeBoolean) {
2020 2020
 				self::$functionReplaceToLocale[] = '$1'.trim($localeBoolean).'$2';
2021 2021
 			}
2022 2022
 		}
2023 2023
 
2024
-		return self::_translateFormula(self::$functionReplaceFromExcel,self::$functionReplaceToLocale,$formula,',',self::$_localeArgumentSeparator);
2024
+		return self::_translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$_localeArgumentSeparator);
2025 2025
 	}	//	function _translateFormulaToLocale()
2026 2026
 
2027 2027
 
2028
-	private static $functionReplaceFromLocale	= null;
2029
-	private static $functionReplaceToExcel		= null;
2028
+	private static $functionReplaceFromLocale = null;
2029
+	private static $functionReplaceToExcel = null;
2030 2030
 
2031 2031
 	public function _translateFormulaToEnglish($formula) {
2032 2032
 		if (self::$functionReplaceFromLocale === NULL) {
2033 2033
 			self::$functionReplaceFromLocale = array();
2034
-			foreach(array_values(self::$_localeFunctions) as $localeFunctionName) {
2034
+			foreach (array_values(self::$_localeFunctions) as $localeFunctionName) {
2035 2035
 				self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui';
2036 2036
 			}
2037
-			foreach(array_values(self::$_localeBoolean) as $excelBoolean) {
2037
+			foreach (array_values(self::$_localeBoolean) as $excelBoolean) {
2038 2038
 				self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
2039 2039
 			}
2040 2040
 		}
2041 2041
 
2042 2042
 		if (self::$functionReplaceToExcel === NULL) {
2043 2043
 			self::$functionReplaceToExcel = array();
2044
-			foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) {
2044
+			foreach (array_keys(self::$_localeFunctions) as $excelFunctionName) {
2045 2045
 				self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2';
2046 2046
 			}
2047
-			foreach(array_keys(self::$_localeBoolean) as $excelBoolean) {
2047
+			foreach (array_keys(self::$_localeBoolean) as $excelBoolean) {
2048 2048
 				self::$functionReplaceToExcel[] = '$1'.trim($excelBoolean).'$2';
2049 2049
 			}
2050 2050
 		}
2051 2051
 
2052
-		return self::_translateFormula(self::$functionReplaceFromLocale,self::$functionReplaceToExcel,$formula,self::$_localeArgumentSeparator,',');
2052
+		return self::_translateFormula(self::$functionReplaceFromLocale, self::$functionReplaceToExcel, $formula, self::$_localeArgumentSeparator, ',');
2053 2053
 	}	//	function _translateFormulaToEnglish()
2054 2054
 
2055 2055
 
2056 2056
 	public static function _localeFunc($function) {
2057 2057
 		if (self::$_localeLanguage !== 'en_us') {
2058
-			$functionName = trim($function,'(');
2058
+			$functionName = trim($function, '(');
2059 2059
 			if (isset(self::$_localeFunctions[$functionName])) {
2060 2060
 				$brace = ($functionName != $function);
2061 2061
 				$function = self::$_localeFunctions[$functionName];
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
 			//	Return strings wrapped in quotes
2085 2085
 			return '"'.$value.'"';
2086 2086
 		//	Convert numeric errors to NaN error
2087
-		} else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
2087
+		} else if ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
2088 2088
 			return PHPExcel_Calculation_Functions::NaN();
2089 2089
 		}
2090 2090
 
@@ -2100,11 +2100,11 @@  discard block
 block discarded – undo
2100 2100
 	 */
2101 2101
 	public static function _unwrapResult($value) {
2102 2102
 		if (is_string($value)) {
2103
-			if ((isset($value{0})) && ($value{0} == '"') && (substr($value,-1) == '"')) {
2104
-				return substr($value,1,-1);
2103
+			if ((isset($value{0})) && ($value{0} == '"') && (substr($value, -1) == '"')) {
2104
+				return substr($value, 1, -1);
2105 2105
 			}
2106 2106
 		//	Convert numeric errors to NaN error
2107
-		} else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
2107
+		} else if ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
2108 2108
 			return PHPExcel_Calculation_Functions::NaN();
2109 2109
 		}
2110 2110
 		return $value;
@@ -2176,11 +2176,11 @@  discard block
 block discarded – undo
2176 2176
 				//	If keys are numeric, then it's a matrix result rather than a cell range result, so we permit it
2177 2177
 				$r = array_keys($result);
2178 2178
 				$r = array_shift($r);
2179
-				if (!is_numeric($r)) { return PHPExcel_Calculation_Functions::VALUE(); }
2179
+				if ( ! is_numeric($r)) { return PHPExcel_Calculation_Functions::VALUE(); }
2180 2180
 				if (is_array($result[$r])) {
2181 2181
 					$c = array_keys($result[$r]);
2182 2182
 					$c = array_shift($c);
2183
-					if (!is_numeric($c)) {
2183
+					if ( ! is_numeric($c)) {
2184 2184
 						return PHPExcel_Calculation_Functions::VALUE();
2185 2185
 					}
2186 2186
 				}
@@ -2190,7 +2190,7 @@  discard block
 block discarded – undo
2190 2190
 
2191 2191
 		if ($result === NULL) {
2192 2192
 			return 0;
2193
-		} elseif((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) {
2193
+		} elseif ((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) {
2194 2194
 			return PHPExcel_Calculation_Functions::NaN();
2195 2195
 		}
2196 2196
 		return $result;
@@ -2208,9 +2208,9 @@  discard block
 block discarded – undo
2208 2208
 		//	Basic validation that this is indeed a formula
2209 2209
 		//	We return an empty array if not
2210 2210
 		$formula = trim($formula);
2211
-		if ((!isset($formula{0})) || ($formula{0} != '=')) return array();
2212
-		$formula = ltrim(substr($formula,1));
2213
-		if (!isset($formula{0})) return array();
2211
+		if (( ! isset($formula{0})) || ($formula{0} != '=')) return array();
2212
+		$formula = ltrim(substr($formula, 1));
2213
+		if ( ! isset($formula{0})) return array();
2214 2214
 
2215 2215
 		//	Parse the formula and return the token stack
2216 2216
 		return $this->_parseFormula($formula);
@@ -2224,7 +2224,7 @@  discard block
 block discarded – undo
2224 2224
 	 * @return	mixed
2225 2225
 	 * @throws	Exception
2226 2226
 	 */
2227
-	public function calculateFormula($formula, $cellID=null, PHPExcel_Cell $pCell = null) {
2227
+	public function calculateFormula($formula, $cellID = null, PHPExcel_Cell $pCell = null) {
2228 2228
 		//	Initialise the logging settings
2229 2229
 		$this->formulaError = null;
2230 2230
 		$this->debugLog = $this->debugLogStack = array();
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
 	 * @return	mixed
2257 2257
 	 * @throws	Exception
2258 2258
 	 */
2259
-	public function _calculateFormulaValue($formula, $cellID=null, PHPExcel_Cell $pCell = null) {
2259
+	public function _calculateFormulaValue($formula, $cellID = null, PHPExcel_Cell $pCell = null) {
2260 2260
 //		echo '<b>'.$cellID.'</b><br />';
2261 2261
 		$cellValue = '';
2262 2262
 
@@ -2264,8 +2264,8 @@  discard block
 block discarded – undo
2264 2264
 		//	We simply return the "cell value" (formula) if not
2265 2265
 		$formula = trim($formula);
2266 2266
 		if ($formula{0} != '=') return self::_wrapResult($formula);
2267
-		$formula = ltrim(substr($formula,1));
2268
-		if (!isset($formula{0})) return self::_wrapResult($formula);
2267
+		$formula = ltrim(substr($formula, 1));
2268
+		if ( ! isset($formula{0})) return self::_wrapResult($formula);
2269 2269
 
2270 2270
 		$wsTitle = "\x00Wrk";
2271 2271
 		if ($pCell !== NULL) {
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 			}
2305 2305
 		}
2306 2306
 
2307
-		if ((in_array($wsTitle.'!'.$cellID,$this->debugLogStack)) && ($wsTitle != "\x00Wrk")) {
2307
+		if ((in_array($wsTitle.'!'.$cellID, $this->debugLogStack)) && ($wsTitle != "\x00Wrk")) {
2308 2308
 			if ($this->cyclicFormulaCount <= 0) {
2309 2309
 				return $this->_raiseFormulaError('Cyclic Reference in Formula');
2310 2310
 			} elseif (($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) &&
@@ -2352,33 +2352,33 @@  discard block
 block discarded – undo
2352 2352
 	 *											1 = shrink to fit
2353 2353
 	 *											2 = extend to fit
2354 2354
 	 */
2355
-	private static function _checkMatrixOperands(&$operand1,&$operand2,$resize = 1) {
2355
+	private static function _checkMatrixOperands(&$operand1, &$operand2, $resize = 1) {
2356 2356
 		//	Examine each of the two operands, and turn them into an array if they aren't one already
2357 2357
 		//	Note that this function should only be called if one or both of the operand is already an array
2358
-		if (!is_array($operand1)) {
2359
-			list($matrixRows,$matrixColumns) = self::_getMatrixDimensions($operand2);
2360
-			$operand1 = array_fill(0,$matrixRows,array_fill(0,$matrixColumns,$operand1));
2358
+		if ( ! is_array($operand1)) {
2359
+			list($matrixRows, $matrixColumns) = self::_getMatrixDimensions($operand2);
2360
+			$operand1 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand1));
2361 2361
 			$resize = 0;
2362
-		} elseif (!is_array($operand2)) {
2363
-			list($matrixRows,$matrixColumns) = self::_getMatrixDimensions($operand1);
2364
-			$operand2 = array_fill(0,$matrixRows,array_fill(0,$matrixColumns,$operand2));
2362
+		} elseif ( ! is_array($operand2)) {
2363
+			list($matrixRows, $matrixColumns) = self::_getMatrixDimensions($operand1);
2364
+			$operand2 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand2));
2365 2365
 			$resize = 0;
2366 2366
 		}
2367 2367
 
2368
-		list($matrix1Rows,$matrix1Columns) = self::_getMatrixDimensions($operand1);
2369
-		list($matrix2Rows,$matrix2Columns) = self::_getMatrixDimensions($operand2);
2368
+		list($matrix1Rows, $matrix1Columns) = self::_getMatrixDimensions($operand1);
2369
+		list($matrix2Rows, $matrix2Columns) = self::_getMatrixDimensions($operand2);
2370 2370
 		if (($matrix1Rows == $matrix2Columns) && ($matrix2Rows == $matrix1Columns)) {
2371 2371
 			$resize = 1;
2372 2372
 		}
2373 2373
 
2374 2374
 		if ($resize == 2) {
2375 2375
 			//	Given two matrices of (potentially) unequal size, convert the smaller in each dimension to match the larger
2376
-			self::_resizeMatricesExtend($operand1,$operand2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns);
2376
+			self::_resizeMatricesExtend($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
2377 2377
 		} elseif ($resize == 1) {
2378 2378
 			//	Given two matrices of (potentially) unequal size, convert the larger in each dimension to match the smaller
2379
-			self::_resizeMatricesShrink($operand1,$operand2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns);
2379
+			self::_resizeMatricesShrink($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
2380 2380
 		}
2381
-		return array( $matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns);
2381
+		return array($matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
2382 2382
 	}	//	function _checkMatrixOperands()
2383 2383
 
2384 2384
 
@@ -2391,16 +2391,16 @@  discard block
 block discarded – undo
2391 2391
 	public static function _getMatrixDimensions(&$matrix) {
2392 2392
 		$matrixRows = count($matrix);
2393 2393
 		$matrixColumns = 0;
2394
-		foreach($matrix as $rowKey => $rowValue) {
2395
-			$matrixColumns = max(count($rowValue),$matrixColumns);
2396
-			if (!is_array($rowValue)) {
2394
+		foreach ($matrix as $rowKey => $rowValue) {
2395
+			$matrixColumns = max(count($rowValue), $matrixColumns);
2396
+			if ( ! is_array($rowValue)) {
2397 2397
 				$matrix[$rowKey] = array($rowValue);
2398 2398
 			} else {
2399 2399
 				$matrix[$rowKey] = array_values($rowValue);
2400 2400
 			}
2401 2401
 		}
2402 2402
 		$matrix = array_values($matrix);
2403
-		return array($matrixRows,$matrixColumns);
2403
+		return array($matrixRows, $matrixColumns);
2404 2404
 	}	//	function _getMatrixDimensions()
2405 2405
 
2406 2406
 
@@ -2410,7 +2410,7 @@  discard block
 block discarded – undo
2410 2410
 	 * @param	mixed		&$matrix1	First matrix operand
2411 2411
 	 * @param	mixed		&$matrix2	Second matrix operand
2412 2412
 	 */
2413
-	private static function _resizeMatricesShrink(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) {
2413
+	private static function _resizeMatricesShrink(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns) {
2414 2414
 		if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
2415 2415
 			if ($matrix2Columns < $matrix1Columns) {
2416 2416
 				for ($i = 0; $i < $matrix1Rows; ++$i) {
@@ -2449,18 +2449,18 @@  discard block
 block discarded – undo
2449 2449
 	 * @param	mixed		&$matrix1	First matrix operand
2450 2450
 	 * @param	mixed		&$matrix2	Second matrix operand
2451 2451
 	 */
2452
-	private static function _resizeMatricesExtend(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) {
2452
+	private static function _resizeMatricesExtend(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns) {
2453 2453
 		if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
2454 2454
 			if ($matrix2Columns < $matrix1Columns) {
2455 2455
 				for ($i = 0; $i < $matrix2Rows; ++$i) {
2456
-					$x = $matrix2[$i][$matrix2Columns-1];
2456
+					$x = $matrix2[$i][$matrix2Columns - 1];
2457 2457
 					for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) {
2458 2458
 						$matrix2[$i][$j] = $x;
2459 2459
 					}
2460 2460
 				}
2461 2461
 			}
2462 2462
 			if ($matrix2Rows < $matrix1Rows) {
2463
-				$x = $matrix2[$matrix2Rows-1];
2463
+				$x = $matrix2[$matrix2Rows - 1];
2464 2464
 				for ($i = 0; $i < $matrix1Rows; ++$i) {
2465 2465
 					$matrix2[$i] = $x;
2466 2466
 				}
@@ -2470,14 +2470,14 @@  discard block
 block discarded – undo
2470 2470
 		if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) {
2471 2471
 			if ($matrix1Columns < $matrix2Columns) {
2472 2472
 				for ($i = 0; $i < $matrix1Rows; ++$i) {
2473
-					$x = $matrix1[$i][$matrix1Columns-1];
2473
+					$x = $matrix1[$i][$matrix1Columns - 1];
2474 2474
 					for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) {
2475 2475
 						$matrix1[$i][$j] = $x;
2476 2476
 					}
2477 2477
 				}
2478 2478
 			}
2479 2479
 			if ($matrix1Rows < $matrix2Rows) {
2480
-				$x = $matrix1[$matrix1Rows-1];
2480
+				$x = $matrix1[$matrix1Rows - 1];
2481 2481
 				for ($i = 0; $i < $matrix2Rows; ++$i) {
2482 2482
 					$matrix1[$i] = $x;
2483 2483
 				}
@@ -2502,18 +2502,18 @@  discard block
 block discarded – undo
2502 2502
 			if (is_array($value)) {
2503 2503
 				$returnMatrix = array();
2504 2504
 				$pad = $rpad = ', ';
2505
-				foreach($value as $row) {
2505
+				foreach ($value as $row) {
2506 2506
 					if (is_array($row)) {
2507
-						$returnMatrix[] = implode($pad,array_map(array($this,'_showValue'),$row));
2507
+						$returnMatrix[] = implode($pad, array_map(array($this, '_showValue'), $row));
2508 2508
 						$rpad = '; ';
2509 2509
 					} else {
2510 2510
 						$returnMatrix[] = $this->_showValue($row);
2511 2511
 					}
2512 2512
 				}
2513
-				return '{ '.implode($rpad,$returnMatrix).' }';
2514
-			} elseif(is_string($value) && (trim($value,'"') == $value)) {
2513
+				return '{ '.implode($rpad, $returnMatrix).' }';
2514
+			} elseif (is_string($value) && (trim($value, '"') == $value)) {
2515 2515
 				return '"'.$value.'"';
2516
-			} elseif(is_bool($value)) {
2516
+			} elseif (is_bool($value)) {
2517 2517
 				return ($value) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE'];
2518 2518
 			}
2519 2519
 		}
@@ -2538,11 +2538,11 @@  discard block
 block discarded – undo
2538 2538
 				return 'a NULL value';
2539 2539
 			} elseif (is_float($value)) {
2540 2540
 				$typeString = 'a floating point number';
2541
-			} elseif(is_int($value)) {
2541
+			} elseif (is_int($value)) {
2542 2542
 				$typeString = 'an integer number';
2543
-			} elseif(is_bool($value)) {
2543
+			} elseif (is_bool($value)) {
2544 2544
 				$typeString = 'a boolean';
2545
-			} elseif(is_array($value)) {
2545
+			} elseif (is_array($value)) {
2546 2546
 				$typeString = 'a matrix';
2547 2547
 			} else {
2548 2548
 				if ($value == '') {
@@ -2559,35 +2559,35 @@  discard block
 block discarded – undo
2559 2559
 
2560 2560
 
2561 2561
 	private static function _convertMatrixReferences($formula) {
2562
-		static $matrixReplaceFrom = array('{',';','}');
2563
-		static $matrixReplaceTo = array('MKMATRIX(MKMATRIX(','),MKMATRIX(','))');
2562
+		static $matrixReplaceFrom = array('{', ';', '}');
2563
+		static $matrixReplaceTo = array('MKMATRIX(MKMATRIX(', '),MKMATRIX(', '))');
2564 2564
 
2565 2565
 		//	Convert any Excel matrix references to the MKMATRIX() function
2566
-		if (strpos($formula,'{') !== false) {
2566
+		if (strpos($formula, '{') !== false) {
2567 2567
 			//	If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
2568
-			if (strpos($formula,'"') !== false) {
2568
+			if (strpos($formula, '"') !== false) {
2569 2569
 				//	So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded
2570 2570
 				//		the formula
2571
-				$temp = explode('"',$formula);
2571
+				$temp = explode('"', $formula);
2572 2572
 				//	Open and Closed counts used for trapping mismatched braces in the formula
2573 2573
 				$openCount = $closeCount = 0;
2574 2574
 				$i = false;
2575
-				foreach($temp as &$value) {
2575
+				foreach ($temp as &$value) {
2576 2576
 					//	Only count/replace in alternating array entries
2577
-					if ($i = !$i) {
2578
-						$openCount += substr_count($value,'{');
2579
-						$closeCount += substr_count($value,'}');
2580
-						$value = str_replace($matrixReplaceFrom,$matrixReplaceTo,$value);
2577
+					if ($i = ! $i) {
2578
+						$openCount += substr_count($value, '{');
2579
+						$closeCount += substr_count($value, '}');
2580
+						$value = str_replace($matrixReplaceFrom, $matrixReplaceTo, $value);
2581 2581
 					}
2582 2582
 				}
2583 2583
 				unset($value);
2584 2584
 				//	Then rebuild the formula string
2585
-				$formula = implode('"',$temp);
2585
+				$formula = implode('"', $temp);
2586 2586
 			} else {
2587 2587
 				//	If there's no quoted strings, then we do a simple count/replace
2588
-				$openCount = substr_count($formula,'{');
2589
-				$closeCount = substr_count($formula,'}');
2590
-				$formula = str_replace($matrixReplaceFrom,$matrixReplaceTo,$formula);
2588
+				$openCount = substr_count($formula, '{');
2589
+				$closeCount = substr_count($formula, '}');
2590
+				$formula = str_replace($matrixReplaceFrom, $matrixReplaceTo, $formula);
2591 2591
 			}
2592 2592
 			//	Trap for mismatched braces and trigger an appropriate error
2593 2593
 			if ($openCount < $closeCount) {
@@ -2627,28 +2627,28 @@  discard block
 block discarded – undo
2627 2627
 		//	Binary Operators
2628 2628
 		//	These operators always work on two values
2629 2629
 		//	Array key is the operator, the value indicates whether this is a left or right associative operator
2630
-		$operatorAssociativity	= array('^' => 0,															//	Exponentiation
2631
-										'*' => 0, '/' => 0, 												//	Multiplication and Division
2632
-										'+' => 0, '-' => 0,													//	Addition and Subtraction
2633
-										'&' => 0,															//	Concatenation
2634
-										'|' => 0, ':' => 0,													//	Intersect and Range
2630
+		$operatorAssociativity = array('^' => 0, //	Exponentiation
2631
+										'*' => 0, '/' => 0, //	Multiplication and Division
2632
+										'+' => 0, '-' => 0, //	Addition and Subtraction
2633
+										'&' => 0, //	Concatenation
2634
+										'|' => 0, ':' => 0, //	Intersect and Range
2635 2635
 										'>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0		//	Comparison
2636 2636
 								 	  );
2637 2637
 		//	Comparison (Boolean) Operators
2638 2638
 		//	These operators work on two values, but always return a boolean result
2639
-		$comparisonOperators	= array('>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true);
2639
+		$comparisonOperators = array('>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true);
2640 2640
 
2641 2641
 		//	Operator Precedence
2642 2642
 		//	This list includes all valid operators, whether binary (including boolean) or unary (such as %)
2643 2643
 		//	Array key is the operator, the value is its precedence
2644
-		$operatorPrecedence	= array(':' => 8,																//	Range
2645
-									'|' => 7,																//	Intersect
2646
-									'~' => 6,																//	Negation
2647
-									'%' => 5,																//	Percentage
2648
-									'^' => 4,																//	Exponentiation
2649
-									'*' => 3, '/' => 3, 													//	Multiplication and Division
2650
-									'+' => 2, '-' => 2,														//	Addition and Subtraction
2651
-									'&' => 1,																//	Concatenation
2644
+		$operatorPrecedence = array(':' => 8, //	Range
2645
+									'|' => 7, //	Intersect
2646
+									'~' => 6, //	Negation
2647
+									'%' => 5, //	Percentage
2648
+									'^' => 4, //	Exponentiation
2649
+									'*' => 3, '/' => 3, //	Multiplication and Division
2650
+									'+' => 2, '-' => 2, //	Addition and Subtraction
2651
+									'&' => 1, //	Concatenation
2652 2652
 									'>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0			//	Comparison
2653 2653
 								   );
2654 2654
 
@@ -2665,17 +2665,17 @@  discard block
 block discarded – undo
2665 2665
 		$index = 0;
2666 2666
 		$stack = new PHPExcel_Token_Stack;
2667 2667
 		$output = array();
2668
-		$expectingOperator = false;					//	We use this test in syntax-checking the expression to determine when a
2668
+		$expectingOperator = false; //	We use this test in syntax-checking the expression to determine when a
2669 2669
 													//		- is a negation or + is a positive operator rather than an operation
2670
-		$expectingOperand = false;					//	We use this test in syntax-checking the expression to determine whether an operand
2670
+		$expectingOperand = false; //	We use this test in syntax-checking the expression to determine whether an operand
2671 2671
 													//		should be null in a function call
2672 2672
 		//	The guts of the lexical parser
2673 2673
 		//	Loop through the formula extracting each operator and operand in turn
2674
-		while(true) {
2674
+		while (true) {
2675 2675
 //			echo 'Assessing Expression <b>'.substr($formula, $index).'</b><br />';
2676 2676
 			$opCharacter = $formula{$index};	//	Get the first character of the value at the current index position
2677 2677
 //			echo 'Initial character of expression block is '.$opCharacter.'<br />';
2678
-			if ((isset($comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset($comparisonOperators[$formula{$index+1}]))) {
2678
+			if ((isset($comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset($comparisonOperators[$formula{$index + 1}]))) {
2679 2679
 				$opCharacter .= $formula{++$index};
2680 2680
 //				echo 'Initial character of expression block is comparison operator '.$opCharacter.'<br />';
2681 2681
 			}
@@ -2685,29 +2685,29 @@  discard block
 block discarded – undo
2685 2685
 //			echo '$isOperandOrFunction is '.(($isOperandOrFunction) ? 'True' : 'False').'<br />';
2686 2686
 //			var_dump($match);
2687 2687
 
2688
-			if ($opCharacter == '-' && !$expectingOperator) {				//	Is it a negation instead of a minus?
2688
+			if ($opCharacter == '-' && ! $expectingOperator) {				//	Is it a negation instead of a minus?
2689 2689
 //				echo 'Element is a Negation operator<br />';
2690
-				$stack->push('Unary Operator','~');							//	Put a negation on the stack
2691
-				++$index;													//		and drop the negation symbol
2690
+				$stack->push('Unary Operator', '~'); //	Put a negation on the stack
2691
+				++$index; //		and drop the negation symbol
2692 2692
 			} elseif ($opCharacter == '%' && $expectingOperator) {
2693 2693
 //				echo 'Element is a Percentage operator<br />';
2694
-				$stack->push('Unary Operator','%');							//	Put a percentage on the stack
2694
+				$stack->push('Unary Operator', '%'); //	Put a percentage on the stack
2695 2695
 				++$index;
2696
-			} elseif ($opCharacter == '+' && !$expectingOperator) {			//	Positive (unary plus rather than binary operator plus) can be discarded?
2696
+			} elseif ($opCharacter == '+' && ! $expectingOperator) {			//	Positive (unary plus rather than binary operator plus) can be discarded?
2697 2697
 //				echo 'Element is a Positive number, not Plus operator<br />';
2698
-				++$index;													//	Drop the redundant plus symbol
2699
-			} elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) {	//	We have to explicitly deny a tilde or pipe, because they are legal
2700
-				return $this->_raiseFormulaError("Formula Error: Illegal character '~'");				//		on the stack but not in the input expression
2698
+				++$index; //	Drop the redundant plus symbol
2699
+			} elseif ((($opCharacter == '~') || ($opCharacter == '|')) && ( ! $isOperandOrFunction)) {	//	We have to explicitly deny a tilde or pipe, because they are legal
2700
+				return $this->_raiseFormulaError("Formula Error: Illegal character '~'"); //		on the stack but not in the input expression
2701 2701
 
2702 2702
 			} elseif ((isset(self::$_operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) {	//	Are we putting an operator on the stack?
2703 2703
 //				echo 'Element with value '.$opCharacter.' is an Operator<br />';
2704
-				while($stack->count() > 0 &&
2704
+				while ($stack->count() > 0 &&
2705 2705
 					($o2 = $stack->last()) &&
2706 2706
 					isset(self::$_operators[$o2['value']]) &&
2707 2707
 					@($operatorAssociativity[$opCharacter] ? $operatorPrecedence[$opCharacter] < $operatorPrecedence[$o2['value']] : $operatorPrecedence[$opCharacter] <= $operatorPrecedence[$o2['value']])) {
2708
-					$output[] = $stack->pop();								//	Swap operands and higher precedence operators from the stack to the output
2708
+					$output[] = $stack->pop(); //	Swap operands and higher precedence operators from the stack to the output
2709 2709
 				}
2710
-				$stack->push('Binary Operator',$opCharacter);	//	Finally put our current operator onto the stack
2710
+				$stack->push('Binary Operator', $opCharacter); //	Finally put our current operator onto the stack
2711 2711
 				++$index;
2712 2712
 				$expectingOperator = false;
2713 2713
 
@@ -2720,10 +2720,10 @@  discard block
 block discarded – undo
2720 2720
 				}
2721 2721
 				$d = $stack->last(2);
2722 2722
 				if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) {	//	Did this parenthesis just close a function?
2723
-					$functionName = $matches[1];										//	Get the function name
2723
+					$functionName = $matches[1]; //	Get the function name
2724 2724
 //					echo 'Closed Function is '.$functionName.'<br />';
2725 2725
 					$d = $stack->pop();
2726
-					$argumentCount = $d['value'];		//	See how many arguments there were (argument count is the next value stored on the stack)
2726
+					$argumentCount = $d['value']; //	See how many arguments there were (argument count is the next value stored on the stack)
2727 2727
 //					if ($argumentCount == 0) {
2728 2728
 //						echo 'With no arguments<br />';
2729 2729
 //					} elseif ($argumentCount == 1) {
@@ -2731,8 +2731,8 @@  discard block
 block discarded – undo
2731 2731
 //					} else {
2732 2732
 //						echo 'With '.$argumentCount.' arguments<br />';
2733 2733
 //					}
2734
-					$output[] = $d;						//	Dump the argument count on the output
2735
-					$output[] = $stack->pop();			//	Pop the function and push onto the output
2734
+					$output[] = $d; //	Dump the argument count on the output
2735
+					$output[] = $stack->pop(); //	Pop the function and push onto the output
2736 2736
 					if (isset(self::$_controlFunctions[$functionName])) {
2737 2737
 //						echo 'Built-in function '.$functionName.'<br />';
2738 2738
 						$expectedArgumentCount = self::$_controlFunctions[$functionName]['argumentCount'];
@@ -2761,7 +2761,7 @@  discard block
 block discarded – undo
2761 2761
 							}
2762 2762
 						}
2763 2763
 					} elseif ($expectedArgumentCount != '*') {
2764
-						$isOperandOrFunction = preg_match('/(\d*)([-+,])(\d*)/',$expectedArgumentCount,$argMatch);
2764
+						$isOperandOrFunction = preg_match('/(\d*)([-+,])(\d*)/', $expectedArgumentCount, $argMatch);
2765 2765
 //						print_r($argMatch);
2766 2766
 //						echo '<br />';
2767 2767
 						switch ($argMatch[2]) {
@@ -2795,30 +2795,30 @@  discard block
 block discarded – undo
2795 2795
 //				echo 'Element is a Function argument separator<br />';
2796 2796
 				while (($o2 = $stack->pop()) && $o2['value'] != '(') {		//	Pop off the stack back to the last (
2797 2797
 					if ($o2 === NULL) return $this->_raiseFormulaError("Formula Error: Unexpected ,");
2798
-					else $output[] = $o2;	// pop the argument expression stuff and push onto the output
2798
+					else $output[] = $o2; // pop the argument expression stuff and push onto the output
2799 2799
 				}
2800 2800
 				//	If we've a comma when we're expecting an operand, then what we actually have is a null operand;
2801 2801
 				//		so push a null onto the stack
2802
-				if (($expectingOperand) || (!$expectingOperator)) {
2802
+				if (($expectingOperand) || ( ! $expectingOperator)) {
2803 2803
 					$output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null);
2804 2804
 				}
2805 2805
 				// make sure there was a function
2806 2806
 				$d = $stack->last(2);
2807
-				if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches))
2807
+				if ( ! preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches))
2808 2808
 					return $this->_raiseFormulaError("Formula Error: Unexpected ,");
2809 2809
 				$d = $stack->pop();
2810
-				$stack->push($d['type'],++$d['value'],$d['reference']);	// increment the argument count
2811
-				$stack->push('Brace', '(');	// put the ( back on, we'll need to pop back to it again
2810
+				$stack->push($d['type'], ++$d['value'], $d['reference']); // increment the argument count
2811
+				$stack->push('Brace', '('); // put the ( back on, we'll need to pop back to it again
2812 2812
 				$expectingOperator = false;
2813 2813
 				$expectingOperand = true;
2814 2814
 				++$index;
2815 2815
 
2816
-			} elseif ($opCharacter == '(' && !$expectingOperator) {
2816
+			} elseif ($opCharacter == '(' && ! $expectingOperator) {
2817 2817
 //				echo 'Element is an Opening Bracket<br />';
2818 2818
 				$stack->push('Brace', '(');
2819 2819
 				++$index;
2820 2820
 
2821
-			} elseif ($isOperandOrFunction && !$expectingOperator) {	// do we now have a function/variable/number?
2821
+			} elseif ($isOperandOrFunction && ! $expectingOperator) {	// do we now have a function/variable/number?
2822 2822
 				$expectingOperator = true;
2823 2823
 				$expectingOperand = false;
2824 2824
 				$val = $match[1];
@@ -2826,11 +2826,11 @@  discard block
 block discarded – undo
2826 2826
 //				echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function<br />';
2827 2827
 
2828 2828
 				if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) {
2829
-					$val = preg_replace('/\s/','',$val);
2829
+					$val = preg_replace('/\s/', '', $val);
2830 2830
 //					echo 'Element '.$val.' is a Function<br />';
2831 2831
 					if (isset(self::$_PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$_controlFunctions[strtoupper($matches[1])])) {	// it's a function
2832 2832
 						$stack->push('Function', strtoupper($val));
2833
-						$ax = preg_match('/^\s*(\s*\))/i', substr($formula, $index+$length), $amatch);
2833
+						$ax = preg_match('/^\s*(\s*\))/i', substr($formula, $index + $length), $amatch);
2834 2834
 						if ($ax) {
2835 2835
 							$stack->push('Operand Count for Function '.strtoupper($val).')', 0);
2836 2836
 							$expectingOperator = true;
@@ -2854,7 +2854,7 @@  discard block
 block discarded – undo
2854 2854
 						if ($matches[2] == '') {
2855 2855
 							//	Otherwise, we 'inherit' the worksheet reference from the start cell reference
2856 2856
 							//	The start of the cell range reference should be the last entry in $output
2857
-							$startCellRef = $output[count($output)-1]['value'];
2857
+							$startCellRef = $output[count($output) - 1]['value'];
2858 2858
 							preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $startCellRef, $startMatches);
2859 2859
 							if ($startMatches[2] > '') {
2860 2860
 								$val = $startMatches[2].'!'.$val;
@@ -2871,28 +2871,28 @@  discard block
 block discarded – undo
2871 2871
 					//	If the last entry on the stack was a : operator, then we may have a row or column range reference
2872 2872
 					$testPrevOp = $stack->last(1);
2873 2873
 					if ($testPrevOp['value'] == ':') {
2874
-						$startRowColRef = $output[count($output)-1]['value'];
2874
+						$startRowColRef = $output[count($output) - 1]['value'];
2875 2875
 						$rangeWS1 = '';
2876
-						if (strpos('!',$startRowColRef) !== false) {
2877
-							list($rangeWS1,$startRowColRef) = explode('!',$startRowColRef);
2876
+						if (strpos('!', $startRowColRef) !== false) {
2877
+							list($rangeWS1, $startRowColRef) = explode('!', $startRowColRef);
2878 2878
 						}
2879 2879
 						if ($rangeWS1 != '') $rangeWS1 .= '!';
2880 2880
 						$rangeWS2 = $rangeWS1;
2881
-						if (strpos('!',$val) !== false) {
2882
-							list($rangeWS2,$val) = explode('!',$val);
2881
+						if (strpos('!', $val) !== false) {
2882
+							list($rangeWS2, $val) = explode('!', $val);
2883 2883
 						}
2884 2884
 						if ($rangeWS2 != '') $rangeWS2 .= '!';
2885 2885
 						if ((is_integer($startRowColRef)) && (ctype_digit($val)) &&
2886 2886
 							($startRowColRef <= 1048576) && ($val <= 1048576)) {
2887 2887
 							//	Row range
2888
-							$endRowColRef = ($pCellParent !== NULL) ? $pCellParent->getHighestColumn() : 'XFD';	//	Max 16,384 columns for Excel2007
2889
-							$output[count($output)-1]['value'] = $rangeWS1.'A'.$startRowColRef;
2888
+							$endRowColRef = ($pCellParent !== NULL) ? $pCellParent->getHighestColumn() : 'XFD'; //	Max 16,384 columns for Excel2007
2889
+							$output[count($output) - 1]['value'] = $rangeWS1.'A'.$startRowColRef;
2890 2890
 							$val = $rangeWS2.$endRowColRef.$val;
2891 2891
 						} elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) &&
2892 2892
 							(strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) {
2893 2893
 							//	Column range
2894
-							$endRowColRef = ($pCellParent !== NULL) ? $pCellParent->getHighestRow() : 1048576;		//	Max 1,048,576 rows for Excel2007
2895
-							$output[count($output)-1]['value'] = $rangeWS1.strtoupper($startRowColRef).'1';
2894
+							$endRowColRef = ($pCellParent !== NULL) ? $pCellParent->getHighestRow() : 1048576; //	Max 1,048,576 rows for Excel2007
2895
+							$output[count($output) - 1]['value'] = $rangeWS1.strtoupper($startRowColRef).'1';
2896 2896
 							$val = $rangeWS2.$val.$endRowColRef;
2897 2897
 						}
2898 2898
 					}
@@ -2901,10 +2901,10 @@  discard block
 block discarded – undo
2901 2901
 					if ($opCharacter == '"') {
2902 2902
 //						echo 'Element is a String<br />';
2903 2903
 						//	UnEscape any quotes within the string
2904
-						$val = self::_wrapResult(str_replace('""','"',self::_unwrapResult($val)));
2904
+						$val = self::_wrapResult(str_replace('""', '"', self::_unwrapResult($val)));
2905 2905
 					} elseif (is_numeric($val)) {
2906 2906
 //						echo 'Element is a Number<br />';
2907
-						if ((strpos($val,'.') !== false) || (stripos($val,'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) {
2907
+						if ((strpos($val, '.') !== false) || (stripos($val, 'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) {
2908 2908
 //							echo 'Casting '.$val.' to float<br />';
2909 2909
 							$val = (float) $val;
2910 2910
 						} else {
@@ -2935,7 +2935,7 @@  discard block
 block discarded – undo
2935 2935
 				} else {
2936 2936
 					return $this->_raiseFormulaError("Formula Error: Unexpected ')'");
2937 2937
 				}
2938
-			} elseif (isset(self::$_operators[$opCharacter]) && !$expectingOperator) {
2938
+			} elseif (isset(self::$_operators[$opCharacter]) && ! $expectingOperator) {
2939 2939
 				return $this->_raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'");
2940 2940
 			} else {	// I don't even want to know what you did to get here
2941 2941
 				return $this->_raiseFormulaError("Formula Error: An unexpected error occured");
@@ -2962,15 +2962,15 @@  discard block
 block discarded – undo
2962 2962
 				//		Cell References) then we have an INTERSECTION operator
2963 2963
 //				echo 'Possible Intersect Operator<br />';
2964 2964
 				if (($expectingOperator) && (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'.*/Ui', substr($formula, $index), $match)) &&
2965
-					($output[count($output)-1]['type'] == 'Cell Reference')) {
2965
+					($output[count($output) - 1]['type'] == 'Cell Reference')) {
2966 2966
 //					echo 'Element is an Intersect Operator<br />';
2967
-					while($stack->count() > 0 &&
2967
+					while ($stack->count() > 0 &&
2968 2968
 						($o2 = $stack->last()) &&
2969 2969
 						isset(self::$_operators[$o2['value']]) &&
2970 2970
 						@($operatorAssociativity[$opCharacter] ? $operatorPrecedence[$opCharacter] < $operatorPrecedence[$o2['value']] : $operatorPrecedence[$opCharacter] <= $operatorPrecedence[$o2['value']])) {
2971
-						$output[] = $stack->pop();								//	Swap operands and higher precedence operators from the stack to the output
2971
+						$output[] = $stack->pop(); //	Swap operands and higher precedence operators from the stack to the output
2972 2972
 					}
2973
-					$stack->push('Binary Operator','|');	//	Put an Intersect Operator on the stack
2973
+					$stack->push('Binary Operator', '|'); //	Put an Intersect Operator on the stack
2974 2974
 					$expectingOperator = false;
2975 2975
 				}
2976 2976
 			}
@@ -2978,7 +2978,7 @@  discard block
 block discarded – undo
2978 2978
 
2979 2979
 		while (($op = $stack->pop()) !== NULL) {	// pop everything off the stack and push onto output
2980 2980
 			if ((is_array($opCharacter) && $opCharacter['value'] == '(') || ($opCharacter === '('))
2981
-				return $this->_raiseFormulaError("Formula Error: Expecting ')'");	// if there are any opening braces on the stack, then braces were unbalanced
2981
+				return $this->_raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced
2982 2982
 			$output[] = $op;
2983 2983
 		}
2984 2984
 		return $output;
@@ -3041,18 +3041,18 @@  discard block
 block discarded – undo
3041 3041
 					case '<='	:			//	Less than or Equal to
3042 3042
 					case '='	:			//	Equality
3043 3043
 					case '<>'	:			//	Inequality
3044
-						$this->_executeBinaryComparisonOperation($cellID,$operand1,$operand2,$token,$stack);
3044
+						$this->_executeBinaryComparisonOperation($cellID, $operand1, $operand2, $token, $stack);
3045 3045
 						break;
3046 3046
 					//	Binary Operators
3047 3047
 					case ':'	:			//	Range
3048 3048
 						$sheet1 = $sheet2 = '';
3049
-						if (strpos($operand1Data['reference'],'!') !== false) {
3050
-							list($sheet1,$operand1Data['reference']) = explode('!',$operand1Data['reference']);
3049
+						if (strpos($operand1Data['reference'], '!') !== false) {
3050
+							list($sheet1, $operand1Data['reference']) = explode('!', $operand1Data['reference']);
3051 3051
 						} else {
3052 3052
 							$sheet1 = ($pCellParent !== NULL) ? $pCellParent->getTitle() : '';
3053 3053
 						}
3054
-						if (strpos($operand2Data['reference'],'!') !== false) {
3055
-							list($sheet2,$operand2Data['reference']) = explode('!',$operand2Data['reference']);
3054
+						if (strpos($operand2Data['reference'], '!') !== false) {
3055
+							list($sheet2, $operand2Data['reference']) = explode('!', $operand2Data['reference']);
3056 3056
 						} else {
3057 3057
 							$sheet2 = $sheet1;
3058 3058
 						}
@@ -3076,9 +3076,9 @@  discard block
 block discarded – undo
3076 3076
 								}
3077 3077
 							}
3078 3078
 
3079
-							$oData = array_merge(explode(':',$operand1Data['reference']),explode(':',$operand2Data['reference']));
3079
+							$oData = array_merge(explode(':', $operand1Data['reference']), explode(':', $operand2Data['reference']));
3080 3080
 							$oCol = $oRow = array();
3081
-							foreach($oData as $oDatum) {
3081
+							foreach ($oData as $oDatum) {
3082 3082
 								$oCR = PHPExcel_Cell::coordinateFromString($oDatum);
3083 3083
 								$oCol[] = PHPExcel_Cell::columnIndexFromString($oCR[0]) - 1;
3084 3084
 								$oRow[] = $oCR[1];
@@ -3089,26 +3089,26 @@  discard block
 block discarded – undo
3089 3089
 							} else {
3090 3090
 								return $this->_raiseFormulaError('Unable to access Cell Reference');
3091 3091
 							}
3092
-							$stack->push('Cell Reference',$cellValue,$cellRef);
3092
+							$stack->push('Cell Reference', $cellValue, $cellRef);
3093 3093
 						} else {
3094
-							$stack->push('Error',PHPExcel_Calculation_Functions::REF(),null);
3094
+							$stack->push('Error', PHPExcel_Calculation_Functions::REF(), null);
3095 3095
 						}
3096 3096
 
3097 3097
 						break;
3098 3098
 					case '+'	:			//	Addition
3099
-						$this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'plusEquals',$stack);
3099
+						$this->_executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'plusEquals', $stack);
3100 3100
 						break;
3101 3101
 					case '-'	:			//	Subtraction
3102
-						$this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'minusEquals',$stack);
3102
+						$this->_executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'minusEquals', $stack);
3103 3103
 						break;
3104 3104
 					case '*'	:			//	Multiplication
3105
-						$this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'arrayTimesEquals',$stack);
3105
+						$this->_executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayTimesEquals', $stack);
3106 3106
 						break;
3107 3107
 					case '/'	:			//	Division
3108
-						$this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'arrayRightDivide',$stack);
3108
+						$this->_executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayRightDivide', $stack);
3109 3109
 						break;
3110 3110
 					case '^'	:			//	Exponential
3111
-						$this->_executeNumericBinaryOperation($cellID,$operand1,$operand2,$token,'power',$stack);
3111
+						$this->_executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'power', $stack);
3112 3112
 						break;
3113 3113
 					case '&'	:			//	Concatenation
3114 3114
 						//	If either of the operands is a matrix, we need to treat them both as matrices
@@ -3122,7 +3122,7 @@  discard block
 block discarded – undo
3122 3122
 						}
3123 3123
 						if ((is_array($operand1)) || (is_array($operand2))) {
3124 3124
 							//	Ensure that both operands are arrays/matrices
3125
-							self::_checkMatrixOperands($operand1,$operand2,2);
3125
+							self::_checkMatrixOperands($operand1, $operand2, 2);
3126 3126
 							try {
3127 3127
 								//	Convert operand 1 from a PHP array to a matrix
3128 3128
 								$matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
@@ -3134,24 +3134,24 @@  discard block
 block discarded – undo
3134 3134
 								$result = '#VALUE!';
3135 3135
 							}
3136 3136
 						} else {
3137
-							$result = '"'.str_replace('""','"',self::_unwrapResult($operand1,'"').self::_unwrapResult($operand2,'"')).'"';
3137
+							$result = '"'.str_replace('""', '"', self::_unwrapResult($operand1, '"').self::_unwrapResult($operand2, '"')).'"';
3138 3138
 						}
3139 3139
 						$this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($result));
3140
-						$stack->push('Value',$result);
3140
+						$stack->push('Value', $result);
3141 3141
 						break;
3142 3142
 					case '|'	:			//	Intersect
3143
-						$rowIntersect = array_intersect_key($operand1,$operand2);
3143
+						$rowIntersect = array_intersect_key($operand1, $operand2);
3144 3144
 						$cellIntersect = $oCol = $oRow = array();
3145
-						foreach(array_keys($rowIntersect) as $row) {
3145
+						foreach (array_keys($rowIntersect) as $row) {
3146 3146
 							$oRow[] = $row;
3147
-							foreach($rowIntersect[$row] as $col => $data) {
3147
+							foreach ($rowIntersect[$row] as $col => $data) {
3148 3148
 								$oCol[] = PHPExcel_Cell::columnIndexFromString($col) - 1;
3149
-								$cellIntersect[$row] = array_intersect_key($operand1[$row],$operand2[$row]);
3149
+								$cellIntersect[$row] = array_intersect_key($operand1[$row], $operand2[$row]);
3150 3150
 							}
3151 3151
 						}
3152 3152
 						$cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
3153 3153
 						$this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($cellIntersect));
3154
-						$stack->push('Value',$cellIntersect,$cellRef);
3154
+						$stack->push('Value', $cellIntersect, $cellRef);
3155 3155
 						break;
3156 3156
 				}
3157 3157
 
@@ -3170,7 +3170,7 @@  discard block
 block discarded – undo
3170 3170
 					$multiplier = 0.01;
3171 3171
 				}
3172 3172
 				if (is_array($arg)) {
3173
-					self::_checkMatrixOperands($arg,$multiplier,2);
3173
+					self::_checkMatrixOperands($arg, $multiplier, 2);
3174 3174
 					try {
3175 3175
 						$matrix1 = new PHPExcel_Shared_JAMA_Matrix($arg);
3176 3176
 						$matrixResult = $matrix1->arrayTimesEquals($multiplier);
@@ -3180,9 +3180,9 @@  discard block
 block discarded – undo
3180 3180
 						$result = '#VALUE!';
3181 3181
 					}
3182 3182
 					$this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($result));
3183
-					$stack->push('Value',$result);
3183
+					$stack->push('Value', $result);
3184 3184
 				} else {
3185
-					$this->_executeNumericBinaryOperation($cellID,$multiplier,$arg,'*','arrayTimesEquals',$stack);
3185
+					$this->_executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack);
3186 3186
 				}
3187 3187
 
3188 3188
 			} elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) {
@@ -3196,12 +3196,12 @@  discard block
 block discarded – undo
3196 3196
 					} else {
3197 3197
 						$cellRef = $matches[6].$matches[7].':'.$matches[9].$matches[10];
3198 3198
 						if ($matches[2] > '') {
3199
-							$matches[2] = trim($matches[2],"\"'");
3200
-							if ((strpos($matches[2],'[') !== false) || (strpos($matches[2],']') !== false)) {
3199
+							$matches[2] = trim($matches[2], "\"'");
3200
+							if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) {
3201 3201
 								//	It's a Reference to an external workbook (not currently supported)
3202 3202
 								return $this->_raiseFormulaError('Unable to access External Workbook');
3203 3203
 							}
3204
-							$matches[2] = trim($matches[2],"\"'");
3204
+							$matches[2] = trim($matches[2], "\"'");
3205 3205
 //							echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
3206 3206
 							$this->_writeDebug('Evaluating Cell Range '.$cellRef.' in worksheet '.$matches[2]);
3207 3207
 							if ($pCellParent !== NULL) {
@@ -3230,8 +3230,8 @@  discard block
 block discarded – undo
3230 3230
 					} else {
3231 3231
 						$cellRef = $matches[6].$matches[7];
3232 3232
 						if ($matches[2] > '') {
3233
-							$matches[2] = trim($matches[2],"\"'");
3234
-							if ((strpos($matches[2],'[') !== false) || (strpos($matches[2],']') !== false)) {
3233
+							$matches[2] = trim($matches[2], "\"'");
3234
+							if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) {
3235 3235
 								//	It's a Reference to an external workbook (not currently supported)
3236 3236
 								return $this->_raiseFormulaError('Unable to access External Workbook');
3237 3237
 							}
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
 						}
3263 3263
 					}
3264 3264
 				}
3265
-				$stack->push('Value',$cellValue,$cellRef);
3265
+				$stack->push('Value', $cellValue, $cellRef);
3266 3266
 
3267 3267
 			// if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
3268 3268
 			} elseif (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $token, $matches)) {
@@ -3316,7 +3316,7 @@  discard block
 block discarded – undo
3316 3316
 					if ($functionName != 'MKMATRIX') {
3317 3317
 						if ($this->writeDebugLog) {
3318 3318
 							krsort($argArrayVals);
3319
-							$this->_writeDebug('Evaluating '. self::_localeFunc($functionName).'( '.implode(self::$_localeArgumentSeparator.' ',PHPExcel_Calculation_Functions::flattenArray($argArrayVals)).' )');
3319
+							$this->_writeDebug('Evaluating '.self::_localeFunc($functionName).'( '.implode(self::$_localeArgumentSeparator.' ', PHPExcel_Calculation_Functions::flattenArray($argArrayVals)).' )');
3320 3320
 						}
3321 3321
 					}
3322 3322
 					//	Process each argument in turn, building the return value as an array
@@ -3346,20 +3346,20 @@  discard block
 block discarded – undo
3346 3346
 						if ($passCellReference) {
3347 3347
 							$args[] = $pCell;
3348 3348
 						}
3349
-						if (strpos($functionCall,'::') !== false) {
3350
-							$result = call_user_func_array(explode('::',$functionCall),$args);
3349
+						if (strpos($functionCall, '::') !== false) {
3350
+							$result = call_user_func_array(explode('::', $functionCall), $args);
3351 3351
 						} else {
3352
-							foreach($args as &$arg) {
3352
+							foreach ($args as &$arg) {
3353 3353
 								$arg = PHPExcel_Calculation_Functions::flattenSingleValue($arg);
3354 3354
 							}
3355 3355
 							unset($arg);
3356
-							$result = call_user_func_array($functionCall,$args);
3356
+							$result = call_user_func_array($functionCall, $args);
3357 3357
 						}
3358 3358
 //					}
3359 3359
 					if ($functionName != 'MKMATRIX') {
3360 3360
 						$this->_writeDebug('Evaluation Result for '.self::_localeFunc($functionName).'() function call is '.$this->_showTypeDetails($result));
3361 3361
 					}
3362
-					$stack->push('Value',self::_wrapResult($result));
3362
+					$stack->push('Value', self::_wrapResult($result));
3363 3363
 				}
3364 3364
 
3365 3365
 			} else {
@@ -3367,11 +3367,11 @@  discard block
 block discarded – undo
3367 3367
 				if (isset(self::$_ExcelConstants[strtoupper($token)])) {
3368 3368
 					$excelConstant = strtoupper($token);
3369 3369
 //					echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
3370
-					$stack->push('Constant Value',self::$_ExcelConstants[$excelConstant]);
3370
+					$stack->push('Constant Value', self::$_ExcelConstants[$excelConstant]);
3371 3371
 					$this->_writeDebug('Evaluating Constant '.$excelConstant.' as '.$this->_showTypeDetails(self::$_ExcelConstants[$excelConstant]));
3372 3372
 				} elseif ((is_numeric($token)) || ($token === NULL) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
3373 3373
 //					echo 'Token is a number, boolean, string, null or an Excel error<br />';
3374
-					$stack->push('Value',$token);
3374
+					$stack->push('Value', $token);
3375 3375
 				// if the token is a named range, push the named range name onto the stack
3376 3376
 				} elseif (preg_match('/^'.self::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $token, $matches)) {
3377 3377
 //					echo 'Token is a named range<br />';
@@ -3381,7 +3381,7 @@  discard block
 block discarded – undo
3381 3381
 					$cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellParent : null), false);
3382 3382
 					$pCell->attach($pCellParent);
3383 3383
 					$this->_writeDebug('Evaluation Result for named range '.$namedRange.' is '.$this->_showTypeDetails($cellValue));
3384
-					$stack->push('Named Range',$cellValue,$namedRange);
3384
+					$stack->push('Named Range', $cellValue, $namedRange);
3385 3385
 				} else {
3386 3386
 					return $this->_raiseFormulaError("undefined variable '$token'");
3387 3387
 				}
@@ -3399,20 +3399,20 @@  discard block
 block discarded – undo
3399 3399
 	}	//	function _processTokenStack()
3400 3400
 
3401 3401
 
3402
-	private function _validateBinaryOperand($cellID,&$operand,&$stack) {
3402
+	private function _validateBinaryOperand($cellID, &$operand, &$stack) {
3403 3403
 		//	Numbers, matrices and booleans can pass straight through, as they're already valid
3404 3404
 		if (is_string($operand)) {
3405 3405
 			//	We only need special validations for the operand if it is a string
3406 3406
 			//	Start by stripping off the quotation marks we use to identify true excel string values internally
3407 3407
 			if ($operand > '' && $operand{0} == '"') { $operand = self::_unwrapResult($operand); }
3408 3408
 			//	If the string is a numeric value, we treat it as a numeric, so no further testing
3409
-			if (!is_numeric($operand)) {
3409
+			if ( ! is_numeric($operand)) {
3410 3410
 				//	If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations
3411 3411
 				if ($operand > '' && $operand{0} == '#') {
3412 3412
 					$stack->push('Value', $operand);
3413 3413
 					$this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($operand));
3414 3414
 					return false;
3415
-				} elseif (!PHPExcel_Shared_String::convertToNumberIfFraction($operand)) {
3415
+				} elseif ( ! PHPExcel_Shared_String::convertToNumberIfFraction($operand)) {
3416 3416
 					//	If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations
3417 3417
 					$stack->push('Value', '#VALUE!');
3418 3418
 					$this->_writeDebug('Evaluation Result is a '.$this->_showTypeDetails('#VALUE!'));
@@ -3426,29 +3426,29 @@  discard block
 block discarded – undo
3426 3426
 	}	//	function _validateBinaryOperand()
3427 3427
 
3428 3428
 
3429
-	private function _executeBinaryComparisonOperation($cellID,$operand1,$operand2,$operation,&$stack,$recursingArrays=false) {
3429
+	private function _executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, &$stack, $recursingArrays = false) {
3430 3430
 		//	If we're dealing with matrix operations, we want a matrix result
3431 3431
 		if ((is_array($operand1)) || (is_array($operand2))) {
3432 3432
 			$result = array();
3433
-			if ((is_array($operand1)) && (!is_array($operand2))) {
3434
-				foreach($operand1 as $x => $operandData) {
3433
+			if ((is_array($operand1)) && ( ! is_array($operand2))) {
3434
+				foreach ($operand1 as $x => $operandData) {
3435 3435
 					$this->_writeDebug('Evaluating Comparison '.$this->_showValue($operandData).' '.$operation.' '.$this->_showValue($operand2));
3436
-					$this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2,$operation,$stack);
3436
+					$this->_executeBinaryComparisonOperation($cellID, $operandData, $operand2, $operation, $stack);
3437 3437
 					$r = $stack->pop();
3438 3438
 					$result[$x] = $r['value'];
3439 3439
 				}
3440
-			} elseif ((!is_array($operand1)) && (is_array($operand2))) {
3441
-				foreach($operand2 as $x => $operandData) {
3440
+			} elseif (( ! is_array($operand1)) && (is_array($operand2))) {
3441
+				foreach ($operand2 as $x => $operandData) {
3442 3442
 					$this->_writeDebug('Evaluating Comparison '.$this->_showValue($operand1).' '.$operation.' '.$this->_showValue($operandData));
3443
-					$this->_executeBinaryComparisonOperation($cellID,$operand1,$operandData,$operation,$stack);
3443
+					$this->_executeBinaryComparisonOperation($cellID, $operand1, $operandData, $operation, $stack);
3444 3444
 					$r = $stack->pop();
3445 3445
 					$result[$x] = $r['value'];
3446 3446
 				}
3447 3447
 			} else {
3448
-				if (!$recursingArrays) { self::_checkMatrixOperands($operand1,$operand2,2); }
3449
-				foreach($operand1 as $x => $operandData) {
3448
+				if ( ! $recursingArrays) { self::_checkMatrixOperands($operand1, $operand2, 2); }
3449
+				foreach ($operand1 as $x => $operandData) {
3450 3450
 					$this->_writeDebug('Evaluating Comparison '.$this->_showValue($operandData).' '.$operation.' '.$this->_showValue($operand2[$x]));
3451
-					$this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2[$x],$operation,$stack,true);
3451
+					$this->_executeBinaryComparisonOperation($cellID, $operandData, $operand2[$x], $operation, $stack, true);
3452 3452
 					$r = $stack->pop();
3453 3453
 					$result[$x] = $r['value'];
3454 3454
 				}
@@ -3456,7 +3456,7 @@  discard block
 block discarded – undo
3456 3456
 			//	Log the result details
3457 3457
 			$this->_writeDebug('Comparison Evaluation Result is '.$this->_showTypeDetails($result));
3458 3458
 			//	And push the result onto the stack
3459
-			$stack->push('Array',$result);
3459
+			$stack->push('Array', $result);
3460 3460
 			return true;
3461 3461
 		}
3462 3462
 
@@ -3495,15 +3495,15 @@  discard block
 block discarded – undo
3495 3495
 		//	Log the result details
3496 3496
 		$this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($result));
3497 3497
 		//	And push the result onto the stack
3498
-		$stack->push('Value',$result);
3498
+		$stack->push('Value', $result);
3499 3499
 		return true;
3500 3500
 	}	//	function _executeBinaryComparisonOperation()
3501 3501
 
3502 3502
 
3503
-	private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
3503
+	private function _executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, &$stack) {
3504 3504
 		//	Validate the two operands
3505
-		if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return false;
3506
-		if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) return false;
3505
+		if ( ! $this->_validateBinaryOperand($cellID, $operand1, $stack)) return false;
3506
+		if ( ! $this->_validateBinaryOperand($cellID, $operand2, $stack)) return false;
3507 3507
 
3508 3508
 		$executeMatrixOperation = false;
3509 3509
 		//	If either of the operands is a matrix, we need to treat them both as matrices
@@ -3513,7 +3513,7 @@  discard block
 block discarded – undo
3513 3513
 			//	Ensure that both operands are arrays/matrices
3514 3514
 			$executeMatrixOperation = true;
3515 3515
 			$mSize = array();
3516
-			list($mSize[],$mSize[],$mSize[],$mSize[]) = self::_checkMatrixOperands($operand1,$operand2,2);
3516
+			list($mSize[], $mSize[], $mSize[], $mSize[]) = self::_checkMatrixOperands($operand1, $operand2, 2);
3517 3517
 
3518 3518
 			//	But if they're both single cell matrices, then we can treat them as simple values
3519 3519
 			if (array_sum($mSize) == 4) {
@@ -3536,37 +3536,37 @@  discard block
 block discarded – undo
3536 3536
 			}
3537 3537
 		} else {
3538 3538
 			if ((PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) &&
3539
-				((is_string($operand1) && !is_numeric($operand1)) || (is_string($operand2) && !is_numeric($operand2)))) {
3539
+				((is_string($operand1) && ! is_numeric($operand1)) || (is_string($operand2) && ! is_numeric($operand2)))) {
3540 3540
 				$result = PHPExcel_Calculation_Functions::VALUE();
3541 3541
 			} else {
3542 3542
 				//	If we're dealing with non-matrix operations, execute the necessary operation
3543 3543
 				switch ($operation) {
3544 3544
 					//	Addition
3545 3545
 					case '+':
3546
-						$result = $operand1+$operand2;
3546
+						$result = $operand1 + $operand2;
3547 3547
 						break;
3548 3548
 					//	Subtraction
3549 3549
 					case '-':
3550
-						$result = $operand1-$operand2;
3550
+						$result = $operand1 - $operand2;
3551 3551
 						break;
3552 3552
 					//	Multiplication
3553 3553
 					case '*':
3554
-						$result = $operand1*$operand2;
3554
+						$result = $operand1 * $operand2;
3555 3555
 						break;
3556 3556
 					//	Division
3557 3557
 					case '/':
3558 3558
 						if ($operand2 == 0) {
3559 3559
 							//	Trap for Divide by Zero error
3560
-							$stack->push('Value','#DIV/0!');
3560
+							$stack->push('Value', '#DIV/0!');
3561 3561
 							$this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails('#DIV/0!'));
3562 3562
 							return false;
3563 3563
 						} else {
3564
-							$result = $operand1/$operand2;
3564
+							$result = $operand1 / $operand2;
3565 3565
 						}
3566 3566
 						break;
3567 3567
 					//	Power
3568 3568
 					case '^':
3569
-						$result = pow($operand1,$operand2);
3569
+						$result = pow($operand1, $operand2);
3570 3570
 						break;
3571 3571
 				}
3572 3572
 			}
@@ -3575,7 +3575,7 @@  discard block
 block discarded – undo
3575 3575
 		//	Log the result details
3576 3576
 		$this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($result));
3577 3577
 		//	And push the result onto the stack
3578
-		$stack->push('Value',$result);
3578
+		$stack->push('Value', $result);
3579 3579
 		return true;
3580 3580
 	}	//	function _executeNumericBinaryOperation()
3581 3581
 
@@ -3584,9 +3584,9 @@  discard block
 block discarded – undo
3584 3584
 		//	Only write the debug log if logging is enabled
3585 3585
 		if ($this->writeDebugLog) {
3586 3586
 			if ($this->echoDebugLog) {
3587
-				echo implode(' -> ',$this->debugLogStack).' -> '.$message,'<br />';
3587
+				echo implode(' -> ', $this->debugLogStack).' -> '.$message, '<br />';
3588 3588
 			}
3589
-			$this->debugLog[] = implode(' -> ',$this->debugLogStack).' -> '.$message;
3589
+			$this->debugLog[] = implode(' -> ', $this->debugLogStack).' -> '.$message;
3590 3590
 		}
3591 3591
 	}	//	function _writeDebug()
3592 3592
 
@@ -3595,7 +3595,7 @@  discard block
 block discarded – undo
3595 3595
 	protected function _raiseFormulaError($errorMessage) {
3596 3596
 		$this->formulaError = $errorMessage;
3597 3597
 		$this->debugLogStack = array();
3598
-		if (!$this->suppressFormulaErrors) throw new Exception($errorMessage);
3598
+		if ( ! $this->suppressFormulaErrors) throw new Exception($errorMessage);
3599 3599
 		trigger_error($errorMessage, E_USER_ERROR);
3600 3600
 	}	//	function _raiseFormulaError()
3601 3601
 
@@ -3608,15 +3608,15 @@  discard block
 block discarded – undo
3608 3608
 	 * @return  mixed				Array of values in range if range contains more than one element. Otherwise, a single value is returned.
3609 3609
 	 * @throws	Exception
3610 3610
 	 */
3611
-	public function extractCellRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog=true) {
3611
+	public function extractCellRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog = true) {
3612 3612
 		// Return value
3613
-		$returnValue = array ();
3613
+		$returnValue = array();
3614 3614
 
3615 3615
 //		echo 'extractCellRange('.$pRange.')<br />';
3616 3616
 		if ($pSheet !== NULL) {
3617 3617
 //			echo 'Passed sheet name is '.$pSheet->getTitle().'<br />';
3618 3618
 //			echo 'Range reference is '.$pRange.'<br />';
3619
-			if (strpos ($pRange, '!') !== false) {
3619
+			if (strpos($pRange, '!') !== false) {
3620 3620
 //				echo '$pRange reference includes sheet reference<br />';
3621 3621
 				$worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
3622 3622
 				$pSheet = $pSheet->getParent()->getSheetByName($worksheetReference[0]);
@@ -3628,9 +3628,9 @@  discard block
 block discarded – undo
3628 3628
 			// Extract range
3629 3629
 			$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
3630 3630
 			$pRange = $pSheet->getTitle().'!'.$pRange;
3631
-			if (!isset($aReferences[1])) {
3631
+			if ( ! isset($aReferences[1])) {
3632 3632
 				//	Single cell in range
3633
-				list($currentCol,$currentRow) = sscanf($aReferences[0],'%[A-Z]%d');
3633
+				list($currentCol, $currentRow) = sscanf($aReferences[0], '%[A-Z]%d');
3634 3634
 				if ($pSheet->cellExists($aReferences[0])) {
3635 3635
 					$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
3636 3636
 				} else {
@@ -3640,7 +3640,7 @@  discard block
 block discarded – undo
3640 3640
 				// Extract cell data for all cells in the range
3641 3641
 				foreach ($aReferences as $reference) {
3642 3642
 					// Extract range
3643
-					list($currentCol,$currentRow) = sscanf($reference,'%[A-Z]%d');
3643
+					list($currentCol, $currentRow) = sscanf($reference, '%[A-Z]%d');
3644 3644
 
3645 3645
 					if ($pSheet->cellExists($reference)) {
3646 3646
 						$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
@@ -3664,15 +3664,15 @@  discard block
 block discarded – undo
3664 3664
 	 * @return  mixed				Array of values in range if range contains more than one element. Otherwise, a single value is returned.
3665 3665
 	 * @throws	Exception
3666 3666
 	 */
3667
-	public function extractNamedRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog=true) {
3667
+	public function extractNamedRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog = true) {
3668 3668
 		// Return value
3669
-		$returnValue = array ();
3669
+		$returnValue = array();
3670 3670
 
3671 3671
 //		echo 'extractNamedRange('.$pRange.')<br />';
3672 3672
 		if ($pSheet !== NULL) {
3673 3673
 //			echo 'Current sheet name is '.$pSheet->getTitle().'<br />';
3674 3674
 //			echo 'Range reference is '.$pRange.'<br />';
3675
-			if (strpos ($pRange, '!') !== false) {
3675
+			if (strpos($pRange, '!') !== false) {
3676 3676
 //				echo '$pRange reference includes sheet reference<br />';
3677 3677
 				$worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
3678 3678
 				$pSheet = $pSheet->getParent()->getSheetByName($worksheetReference[0]);
@@ -3690,9 +3690,9 @@  discard block
 block discarded – undo
3690 3690
 				$splitRange = PHPExcel_Cell::splitRange($pRange);
3691 3691
 				//	Convert row and column references
3692 3692
 				if (ctype_alpha($splitRange[0][0])) {
3693
-					$pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow();
3694
-				} elseif(ctype_digit($splitRange[0][0])) {
3695
-					$pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1];
3693
+					$pRange = $splitRange[0][0].'1:'.$splitRange[0][1].$namedRange->getWorksheet()->getHighestRow();
3694
+				} elseif (ctype_digit($splitRange[0][0])) {
3695
+					$pRange = 'A'.$splitRange[0][0].':'.$namedRange->getWorksheet()->getHighestColumn().$splitRange[0][1];
3696 3696
 				}
3697 3697
 //				echo $pRange.') is in sheet '.$namedRange->getWorksheet()->getTitle().'<br />';
3698 3698
 
@@ -3710,9 +3710,9 @@  discard block
 block discarded – undo
3710 3710
 			// Extract range
3711 3711
 			$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
3712 3712
 //			var_dump($aReferences);
3713
-			if (!isset($aReferences[1])) {
3713
+			if ( ! isset($aReferences[1])) {
3714 3714
 				//	Single cell (or single column or row) in range
3715
-				list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
3715
+				list($currentCol, $currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
3716 3716
 				if ($pSheet->cellExists($aReferences[0])) {
3717 3717
 					$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
3718 3718
 				} else {
@@ -3722,7 +3722,7 @@  discard block
 block discarded – undo
3722 3722
 				// Extract cell data for all cells in the range
3723 3723
 				foreach ($aReferences as $reference) {
3724 3724
 					// Extract range
3725
-					list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($reference);
3725
+					list($currentCol, $currentRow) = PHPExcel_Cell::coordinateFromString($reference);
3726 3726
 //					echo 'NAMED RANGE: $currentCol='.$currentCol.' $currentRow='.$currentRow.'<br />';
3727 3727
 					if ($pSheet->cellExists($reference)) {
3728 3728
 						$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
@@ -3747,7 +3747,7 @@  discard block
 block discarded – undo
3747 3747
 	 * @return	boolean
3748 3748
 	 */
3749 3749
 	public function isImplemented($pFunction = '') {
3750
-		$pFunction = strtoupper ($pFunction);
3750
+		$pFunction = strtoupper($pFunction);
3751 3751
 		if (isset(self::$_PHPExcelFunctions[$pFunction])) {
3752 3752
 			return (self::$_PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
3753 3753
 		} else {
@@ -3765,7 +3765,7 @@  discard block
 block discarded – undo
3765 3765
 		// Return value
3766 3766
 		$returnValue = array();
3767 3767
 		// Loop functions
3768
-		foreach(self::$_PHPExcelFunctions as $functionName => $function) {
3768
+		foreach (self::$_PHPExcelFunctions as $functionName => $function) {
3769 3769
 			if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
3770 3770
 				$returnValue[$functionName] = new PHPExcel_Calculation_Function($function['category'],
3771 3771
 																				$functionName,
@@ -3797,7 +3797,7 @@  discard block
 block discarded – undo
3797 3797
 		// Return value
3798 3798
 		$returnValue = array();
3799 3799
 		// Loop functions
3800
-		foreach(self::$_PHPExcelFunctions as $functionName => $function) {
3800
+		foreach (self::$_PHPExcelFunctions as $functionName => $function) {
3801 3801
 			if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
3802 3802
 				$returnValue[] = $functionName;
3803 3803
 			}
@@ -3824,7 +3824,7 @@  discard block
 block discarded – undo
3824 3824
 	}	//	function count()
3825 3825
 
3826 3826
 
3827
-	public function push($type,$value,$reference=null) {
3827
+	public function push($type, $value, $reference = null) {
3828 3828
 		$this->_stack[$this->_count++] = array('type'		=> $type,
3829 3829
 											   'value'		=> $value,
3830 3830
 											   'reference'	=> $reference
@@ -3846,11 +3846,11 @@  discard block
 block discarded – undo
3846 3846
 	}	//	function pop()
3847 3847
 
3848 3848
 
3849
-	public function last($n=1) {
3850
-		if ($this->_count-$n < 0) {
3849
+	public function last($n = 1) {
3850
+		if ($this->_count - $n < 0) {
3851 3851
 			return null;
3852 3852
 		}
3853
-		return $this->_stack[$this->_count-$n];
3853
+		return $this->_stack[$this->_count - $n];
3854 3854
 	}	//	function last()
3855 3855
 
3856 3856
 
Please login to merge, or discard this patch.
Braces   +60 added lines, -22 removed lines patch added patch discarded remove patch
@@ -2208,9 +2208,13 @@  discard block
 block discarded – undo
2208 2208
 		//	Basic validation that this is indeed a formula
2209 2209
 		//	We return an empty array if not
2210 2210
 		$formula = trim($formula);
2211
-		if ((!isset($formula{0})) || ($formula{0} != '=')) return array();
2211
+		if ((!isset($formula{0})) || ($formula{0} != '=')) {
2212
+			return array();
2213
+		}
2212 2214
 		$formula = ltrim(substr($formula,1));
2213
-		if (!isset($formula{0})) return array();
2215
+		if (!isset($formula{0})) {
2216
+			return array();
2217
+		}
2214 2218
 
2215 2219
 		//	Parse the formula and return the token stack
2216 2220
 		return $this->_parseFormula($formula);
@@ -2263,9 +2267,13 @@  discard block
 block discarded – undo
2263 2267
 		//	Basic validation that this is indeed a formula
2264 2268
 		//	We simply return the "cell value" (formula) if not
2265 2269
 		$formula = trim($formula);
2266
-		if ($formula{0} != '=') return self::_wrapResult($formula);
2270
+		if ($formula{0} != '=') {
2271
+			return self::_wrapResult($formula);
2272
+		}
2267 2273
 		$formula = ltrim(substr($formula,1));
2268
-		if (!isset($formula{0})) return self::_wrapResult($formula);
2274
+		if (!isset($formula{0})) {
2275
+			return self::_wrapResult($formula);
2276
+		}
2269 2277
 
2270 2278
 		$wsTitle = "\x00Wrk";
2271 2279
 		if ($pCell !== NULL) {
@@ -2715,8 +2723,11 @@  discard block
 block discarded – undo
2715 2723
 //				echo 'Element is a Closing bracket<br />';
2716 2724
 				$expectingOperand = false;
2717 2725
 				while (($o2 = $stack->pop()) && $o2['value'] != '(') {		//	Pop off the stack back to the last (
2718
-					if ($o2 === NULL) return $this->_raiseFormulaError('Formula Error: Unexpected closing brace ")"');
2719
-					else $output[] = $o2;
2726
+					if ($o2 === NULL) {
2727
+						return $this->_raiseFormulaError('Formula Error: Unexpected closing brace ")"');
2728
+					} else {
2729
+						$output[] = $o2;
2730
+					}
2720 2731
 				}
2721 2732
 				$d = $stack->last(2);
2722 2733
 				if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) {	//	Did this parenthesis just close a function?
@@ -2794,8 +2805,12 @@  discard block
 block discarded – undo
2794 2805
 			} elseif ($opCharacter == ',') {			//	Is this the separator for function arguments?
2795 2806
 //				echo 'Element is a Function argument separator<br />';
2796 2807
 				while (($o2 = $stack->pop()) && $o2['value'] != '(') {		//	Pop off the stack back to the last (
2797
-					if ($o2 === NULL) return $this->_raiseFormulaError("Formula Error: Unexpected ,");
2798
-					else $output[] = $o2;	// pop the argument expression stuff and push onto the output
2808
+					if ($o2 === NULL) {
2809
+						return $this->_raiseFormulaError("Formula Error: Unexpected ,");
2810
+					} else {
2811
+						$output[] = $o2;
2812
+					}
2813
+					// pop the argument expression stuff and push onto the output
2799 2814
 				}
2800 2815
 				//	If we've a comma when we're expecting an operand, then what we actually have is a null operand;
2801 2816
 				//		so push a null onto the stack
@@ -2804,8 +2819,9 @@  discard block
 block discarded – undo
2804 2819
 				}
2805 2820
 				// make sure there was a function
2806 2821
 				$d = $stack->last(2);
2807
-				if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches))
2808
-					return $this->_raiseFormulaError("Formula Error: Unexpected ,");
2822
+				if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) {
2823
+									return $this->_raiseFormulaError("Formula Error: Unexpected ,");
2824
+				}
2809 2825
 				$d = $stack->pop();
2810 2826
 				$stack->push($d['type'],++$d['value'],$d['reference']);	// increment the argument count
2811 2827
 				$stack->push('Brace', '(');	// put the ( back on, we'll need to pop back to it again
@@ -2876,12 +2892,16 @@  discard block
 block discarded – undo
2876 2892
 						if (strpos('!',$startRowColRef) !== false) {
2877 2893
 							list($rangeWS1,$startRowColRef) = explode('!',$startRowColRef);
2878 2894
 						}
2879
-						if ($rangeWS1 != '') $rangeWS1 .= '!';
2895
+						if ($rangeWS1 != '') {
2896
+							$rangeWS1 .= '!';
2897
+						}
2880 2898
 						$rangeWS2 = $rangeWS1;
2881 2899
 						if (strpos('!',$val) !== false) {
2882 2900
 							list($rangeWS2,$val) = explode('!',$val);
2883 2901
 						}
2884
-						if ($rangeWS2 != '') $rangeWS2 .= '!';
2902
+						if ($rangeWS2 != '') {
2903
+							$rangeWS2 .= '!';
2904
+						}
2885 2905
 						if ((is_integer($startRowColRef)) && (ctype_digit($val)) &&
2886 2906
 							($startRowColRef <= 1048576) && ($val <= 1048576)) {
2887 2907
 							//	Row range
@@ -2977,8 +2997,10 @@  discard block
 block discarded – undo
2977 2997
 		}
2978 2998
 
2979 2999
 		while (($op = $stack->pop()) !== NULL) {	// pop everything off the stack and push onto output
2980
-			if ((is_array($opCharacter) && $opCharacter['value'] == '(') || ($opCharacter === '('))
2981
-				return $this->_raiseFormulaError("Formula Error: Expecting ')'");	// if there are any opening braces on the stack, then braces were unbalanced
3000
+			if ((is_array($opCharacter) && $opCharacter['value'] == '(') || ($opCharacter === '(')) {
3001
+							return $this->_raiseFormulaError("Formula Error: Expecting ')'");
3002
+			}
3003
+			// if there are any opening braces on the stack, then braces were unbalanced
2982 3004
 			$output[] = $op;
2983 3005
 		}
2984 3006
 		return $output;
@@ -3002,7 +3024,9 @@  discard block
 block discarded – undo
3002 3024
 
3003 3025
 	// evaluate postfix notation
3004 3026
 	private function _processTokenStack($tokens, $cellID = null, PHPExcel_Cell $pCell = null) {
3005
-		if ($tokens == false) return false;
3027
+		if ($tokens == false) {
3028
+			return false;
3029
+		}
3006 3030
 
3007 3031
 		//	If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent worksheet),
3008 3032
 		//		so we store the parent worksheet so that we can re-attach it when necessary
@@ -3019,8 +3043,12 @@  discard block
 block discarded – undo
3019 3043
 			if (isset(self::$_binaryOperators[$token])) {
3020 3044
 //				echo 'Token is a binary operator<br />';
3021 3045
 				//	We must have two operands, error if we don't
3022
-				if (($operand2Data = $stack->pop()) === NULL) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
3023
-				if (($operand1Data = $stack->pop()) === NULL) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
3046
+				if (($operand2Data = $stack->pop()) === NULL) {
3047
+					return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
3048
+				}
3049
+				if (($operand1Data = $stack->pop()) === NULL) {
3050
+					return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
3051
+				}
3024 3052
 
3025 3053
 				$operand1 = self::_dataTestReference($operand1Data);
3026 3054
 				$operand2 = self::_dataTestReference($operand2Data);
@@ -3158,7 +3186,9 @@  discard block
 block discarded – undo
3158 3186
 			// if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
3159 3187
 			} elseif (($token === '~') || ($token === '%')) {
3160 3188
 //				echo 'Token is a unary operator<br />';
3161
-				if (($arg = $stack->pop()) === NULL) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
3189
+				if (($arg = $stack->pop()) === NULL) {
3190
+					return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
3191
+				}
3162 3192
 				$arg = $arg['value'];
3163 3193
 				if ($token === '~') {
3164 3194
 //					echo 'Token is a negation operator<br />';
@@ -3388,7 +3418,9 @@  discard block
 block discarded – undo
3388 3418
 			}
3389 3419
 		}
3390 3420
 		// when we're out of tokens, the stack should have a single element, the final result
3391
-		if ($stack->count() != 1) return $this->_raiseFormulaError("internal error");
3421
+		if ($stack->count() != 1) {
3422
+			return $this->_raiseFormulaError("internal error");
3423
+		}
3392 3424
 		$output = $stack->pop();
3393 3425
 		$output = $output['value'];
3394 3426
 
@@ -3502,8 +3534,12 @@  discard block
 block discarded – undo
3502 3534
 
3503 3535
 	private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
3504 3536
 		//	Validate the two operands
3505
-		if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return false;
3506
-		if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) return false;
3537
+		if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) {
3538
+			return false;
3539
+		}
3540
+		if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) {
3541
+			return false;
3542
+		}
3507 3543
 
3508 3544
 		$executeMatrixOperation = false;
3509 3545
 		//	If either of the operands is a matrix, we need to treat them both as matrices
@@ -3595,7 +3631,9 @@  discard block
 block discarded – undo
3595 3631
 	protected function _raiseFormulaError($errorMessage) {
3596 3632
 		$this->formulaError = $errorMessage;
3597 3633
 		$this->debugLogStack = array();
3598
-		if (!$this->suppressFormulaErrors) throw new Exception($errorMessage);
3634
+		if (!$this->suppressFormulaErrors) {
3635
+			throw new Exception($errorMessage);
3636
+		}
3599 3637
 		trigger_error($errorMessage, E_USER_ERROR);
3600 3638
 	}	//	function _raiseFormulaError()
3601 3639
 
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Calculation/DateTime.php 4 patches
Doc Comments   +21 added lines, -26 removed lines patch added patch discarded remove patch
@@ -56,6 +56,9 @@  discard block
 block discarded – undo
56 56
 	}	//	function _isLeapYear()
57 57
 
58 58
 
59
+	/**
60
+	 * @param boolean $methodUS
61
+	 */
59 62
 	private static function _dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS) {
60 63
 		if ($startDay == 31) {
61 64
 			--$startDay;
@@ -443,7 +446,7 @@  discard block
 block discarded – undo
443 446
 	 *
444 447
 	 * @access	public
445 448
 	 * @category Date/Time Functions
446
-	 * @param	string	$dateValue		Text that represents a date in a Microsoft Excel date format.
449
+	 * @param	integer	$dateValue		Text that represents a date in a Microsoft Excel date format.
447 450
 	 *									For example, "1/30/2008" or "30-Jan-2008" are text strings within
448 451
 	 *									quotation marks that represent dates. Using the default date
449 452
 	 *									system in Excel for Windows, date_text must represent a date from
@@ -584,9 +587,9 @@  discard block
 block discarded – undo
584 587
 	/**
585 588
 	 * DATEDIF
586 589
 	 *
587
-	 * @param	mixed	$startDate		Excel date serial value, PHP date/time stamp, PHP DateTime object
590
+	 * @param	integer	$startDate		Excel date serial value, PHP date/time stamp, PHP DateTime object
588 591
 	 *									or a standard date string
589
-	 * @param	mixed	$endDate		Excel date serial value, PHP date/time stamp, PHP DateTime object
592
+	 * @param	integer	$endDate		Excel date serial value, PHP date/time stamp, PHP DateTime object
590 593
 	 *									or a standard date string
591 594
 	 * @param	string	$unit
592 595
 	 * @return	integer	Interval between the dates
@@ -692,9 +695,9 @@  discard block
 block discarded – undo
692 695
 	 *
693 696
 	 * @access	public
694 697
 	 * @category Date/Time Functions
695
-	 * @param	mixed		$startDate		Excel date serial value (float), PHP date timestamp (integer),
698
+	 * @param	integer		$startDate		Excel date serial value (float), PHP date timestamp (integer),
696 699
 	 *										PHP DateTime object, or a standard date string
697
-	 * @param	mixed		$endDate		Excel date serial value (float), PHP date timestamp (integer),
700
+	 * @param	integer		$endDate		Excel date serial value (float), PHP date timestamp (integer),
698 701
 	 *										PHP DateTime object, or a standard date string
699 702
 	 * @param	boolean		$method			US or European Method
700 703
 	 *										FALSE or omitted: U.S. (NASD) method. If the starting date is
@@ -748,9 +751,9 @@  discard block
 block discarded – undo
748 751
 	 *
749 752
 	 * @access	public
750 753
 	 * @category Date/Time Functions
751
-	 * @param	mixed	$startDate		Excel date serial value (float), PHP date timestamp (integer),
754
+	 * @param	integer	$startDate		Excel date serial value (float), PHP date timestamp (integer),
752 755
 	 *									PHP DateTime object, or a standard date string
753
-	 * @param	mixed	$endDate		Excel date serial value (float), PHP date timestamp (integer),
756
+	 * @param	integer	$endDate		Excel date serial value (float), PHP date timestamp (integer),
754 757
 	 *									PHP DateTime object, or a standard date string
755 758
 	 * @param	integer	$method			Method used for the calculation
756 759
 	 *										0 or omitted	US (NASD) 30/360
@@ -849,10 +852,6 @@  discard block
 block discarded – undo
849 852
 	 *											PHP DateTime object, or a standard date string
850 853
 	 * @param	mixed			$endDate		Excel date serial value (float), PHP date timestamp (integer),
851 854
 	 *											PHP DateTime object, or a standard date string
852
-	 * @param	mixed			$holidays,...	Optional series of Excel date serial value (float), PHP date
853
-	 *											timestamp (integer), PHP DateTime object, or a standard date
854
-	 *											strings that will be excluded from the working calendar, such
855
-	 *											as state and federal holidays and floating holidays.
856 855
 	 * @return	integer			Interval between the dates
857 856
 	 */
858 857
 	public static function NETWORKDAYS($startDate,$endDate) {
@@ -930,10 +929,6 @@  discard block
 block discarded – undo
930 929
 	 * @param	integer		$endDays		The number of nonweekend and nonholiday days before or after
931 930
 	 *										startDate. A positive value for days yields a future date; a
932 931
 	 *										negative value yields a past date.
933
-	 * @param	mixed		$holidays,...	Optional series of Excel date serial value (float), PHP date
934
-	 *										timestamp (integer), PHP DateTime object, or a standard date
935
-	 *										strings that will be excluded from the working calendar, such
936
-	 *										as state and federal holidays and floating holidays.
937 932
 	 * @return	mixed	Excel date/time serial value, PHP date/time serial value or PHP date/time object,
938 933
 	 *						depending on the value of the ReturnDateType flag
939 934
 	 */
@@ -1036,7 +1031,7 @@  discard block
 block discarded – undo
1036 1031
 	 * Excel Function:
1037 1032
 	 *		DAY(dateValue)
1038 1033
 	 *
1039
-	 * @param	mixed	$dateValue		Excel date serial value (float), PHP date timestamp (integer),
1034
+	 * @param	integer	$dateValue		Excel date serial value (float), PHP date timestamp (integer),
1040 1035
 	 *									PHP DateTime object, or a standard date string
1041 1036
 	 * @return	int		Day of the month
1042 1037
 	 */
@@ -1067,7 +1062,7 @@  discard block
 block discarded – undo
1067 1062
 	 * Excel Function:
1068 1063
 	 *		WEEKDAY(dateValue[,style])
1069 1064
 	 *
1070
-	 * @param	mixed	$dateValue		Excel date serial value (float), PHP date timestamp (integer),
1065
+	 * @param	integer	$dateValue		Excel date serial value (float), PHP date timestamp (integer),
1071 1066
 	 *									PHP DateTime object, or a standard date string
1072 1067
 	 * @param	int		$style			A number that determines the type of return value
1073 1068
 	 *										1 or omitted	Numbers 1 (Sunday) through 7 (Saturday).
@@ -1134,9 +1129,9 @@  discard block
 block discarded – undo
1134 1129
 	 * Excel Function:
1135 1130
 	 *		WEEKNUM(dateValue[,style])
1136 1131
 	 *
1137
-	 * @param	mixed	$dateValue		Excel date serial value (float), PHP date timestamp (integer),
1132
+	 * @param	integer	$dateValue		Excel date serial value (float), PHP date timestamp (integer),
1138 1133
 	 *									PHP DateTime object, or a standard date string
1139
-	 * @param	boolean	$method			Week begins on Sunday or Monday
1134
+	 * @param	integer	$method			Week begins on Sunday or Monday
1140 1135
 	 *										1 or omitted	Week begins on Sunday.
1141 1136
 	 *										2				Week begins on Monday.
1142 1137
 	 * @return	int		Week Number
@@ -1181,7 +1176,7 @@  discard block
 block discarded – undo
1181 1176
 	 * Excel Function:
1182 1177
 	 *		MONTH(dateValue)
1183 1178
 	 *
1184
-	 * @param	mixed	$dateValue		Excel date serial value (float), PHP date timestamp (integer),
1179
+	 * @param	integer	$dateValue		Excel date serial value (float), PHP date timestamp (integer),
1185 1180
 	 *									PHP DateTime object, or a standard date string
1186 1181
 	 * @return	int		Month of the year
1187 1182
 	 */
@@ -1210,7 +1205,7 @@  discard block
 block discarded – undo
1210 1205
 	 * Excel Function:
1211 1206
 	 *		YEAR(dateValue)
1212 1207
 	 *
1213
-	 * @param	mixed	$dateValue		Excel date serial value (float), PHP date timestamp (integer),
1208
+	 * @param	integer	$dateValue		Excel date serial value (float), PHP date timestamp (integer),
1214 1209
 	 *									PHP DateTime object, or a standard date string
1215 1210
 	 * @return	int		Year
1216 1211
 	 */
@@ -1239,7 +1234,7 @@  discard block
 block discarded – undo
1239 1234
 	 * Excel Function:
1240 1235
 	 *		HOUR(timeValue)
1241 1236
 	 *
1242
-	 * @param	mixed	$timeValue		Excel date serial value (float), PHP date timestamp (integer),
1237
+	 * @param	integer	$timeValue		Excel date serial value (float), PHP date timestamp (integer),
1243 1238
 	 *									PHP DateTime object, or a standard time string
1244 1239
 	 * @return	int		Hour
1245 1240
 	 */
@@ -1279,7 +1274,7 @@  discard block
 block discarded – undo
1279 1274
 	 * Excel Function:
1280 1275
 	 *		MINUTE(timeValue)
1281 1276
 	 *
1282
-	 * @param	mixed	$timeValue		Excel date serial value (float), PHP date timestamp (integer),
1277
+	 * @param	integer	$timeValue		Excel date serial value (float), PHP date timestamp (integer),
1283 1278
 	 *									PHP DateTime object, or a standard time string
1284 1279
 	 * @return	int		Minute
1285 1280
 	 */
@@ -1319,7 +1314,7 @@  discard block
 block discarded – undo
1319 1314
 	 * Excel Function:
1320 1315
 	 *		SECOND(timeValue)
1321 1316
 	 *
1322
-	 * @param	mixed	$timeValue		Excel date serial value (float), PHP date timestamp (integer),
1317
+	 * @param	integer	$timeValue		Excel date serial value (float), PHP date timestamp (integer),
1323 1318
 	 *									PHP DateTime object, or a standard time string
1324 1319
 	 * @return	int		Second
1325 1320
 	 */
@@ -1361,7 +1356,7 @@  discard block
 block discarded – undo
1361 1356
 	 * Excel Function:
1362 1357
 	 *		EDATE(dateValue,adjustmentMonths)
1363 1358
 	 *
1364
-	 * @param	mixed	$dateValue			Excel date serial value (float), PHP date timestamp (integer),
1359
+	 * @param	integer	$dateValue			Excel date serial value (float), PHP date timestamp (integer),
1365 1360
 	 *										PHP DateTime object, or a standard date string
1366 1361
 	 * @param	int		$adjustmentMonths	The number of months before or after start_date.
1367 1362
 	 *										A positive value for months yields a future date;
@@ -1406,7 +1401,7 @@  discard block
 block discarded – undo
1406 1401
 	 * Excel Function:
1407 1402
 	 *		EOMONTH(dateValue,adjustmentMonths)
1408 1403
 	 *
1409
-	 * @param	mixed	$dateValue			Excel date serial value (float), PHP date timestamp (integer),
1404
+	 * @param	integer	$dateValue			Excel date serial value (float), PHP date timestamp (integer),
1410 1405
 	 *										PHP DateTime object, or a standard date string
1411 1406
 	 * @param	int		$adjustmentMonths	The number of months before or after start_date.
1412 1407
 	 *										A positive value for months yields a future date;
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -789,7 +789,7 @@
 block discarded – undo
789 789
 							$endDay = self::DAYOFMONTH($endDate);
790 790
 							if (($startMonth < 3) ||
791 791
 								(($endMonth * 100 + $endDay) >= (2 * 100 + 29))) {
792
-				     			$leapDays += 1;
792
+					 			$leapDays += 1;
793 793
 							}
794 794
 						}
795 795
 					} else {
Please login to merge, or discard this patch.
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
 
29 29
 /** PHPExcel root directory */
30
-if (!defined('PHPEXCEL_ROOT')) {
30
+if ( ! defined('PHPEXCEL_ROOT')) {
31 31
 	/**
32 32
 	 * @ignore
33 33
 	 */
34
-	define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
35
-	require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
34
+	define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../');
35
+	require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php');
36 36
 }
37 37
 
38 38
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	private static function _dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS) {
60 60
 		if ($startDay == 31) {
61 61
 			--$startDay;
62
-		} elseif ($methodUS && ($startMonth == 2 && ($startDay == 29 || ($startDay == 28 && !self::_isLeapYear($startYear))))) {
62
+		} elseif ($methodUS && ($startMonth == 2 && ($startDay == 29 || ($startDay == 28 && ! self::_isLeapYear($startYear))))) {
63 63
 			$startDay = 30;
64 64
 		}
65 65
 		if ($endDay == 31) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @return	mixed	Excel date/time serial value, or string if error
88 88
 	 */
89 89
 	public static function _getDateValue($dateValue) {
90
-		if (!is_numeric($dateValue)) {
90
+		if ( ! is_numeric($dateValue)) {
91 91
 			if ((is_string($dateValue)) &&
92 92
 				(PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
93 93
 				return PHPExcel_Calculation_Functions::VALUE();
@@ -274,32 +274,32 @@  discard block
 block discarded – undo
274 274
 	 *						depending on the value of the ReturnDateType flag
275 275
 	 */
276 276
 	public static function DATE($year = 0, $month = 1, $day = 1) {
277
-		$year	= PHPExcel_Calculation_Functions::flattenSingleValue($year);
278
-		$month	= PHPExcel_Calculation_Functions::flattenSingleValue($month);
279
-		$day	= PHPExcel_Calculation_Functions::flattenSingleValue($day);
280
-
281
-		$year	= ($year !== NULL)	? PHPExcel_Shared_String::testStringAsNumeric($year) : 0;
282
-		$month	= ($month !== NULL)	? PHPExcel_Shared_String::testStringAsNumeric($month) : 0;
283
-		$day	= ($day !== NULL)	? PHPExcel_Shared_String::testStringAsNumeric($day) : 0;
284
-		if ((!is_numeric($year)) ||
285
-			(!is_numeric($month)) ||
286
-			(!is_numeric($day))) {
277
+		$year = PHPExcel_Calculation_Functions::flattenSingleValue($year);
278
+		$month = PHPExcel_Calculation_Functions::flattenSingleValue($month);
279
+		$day = PHPExcel_Calculation_Functions::flattenSingleValue($day);
280
+
281
+		$year = ($year !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($year) : 0;
282
+		$month = ($month !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0;
283
+		$day = ($day !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0;
284
+		if (( ! is_numeric($year)) ||
285
+			( ! is_numeric($month)) ||
286
+			( ! is_numeric($day))) {
287 287
 			return PHPExcel_Calculation_Functions::VALUE();
288 288
 		}
289
-		$year	= (integer) $year;
290
-		$month	= (integer) $month;
291
-		$day	= (integer) $day;
289
+		$year = (integer) $year;
290
+		$month = (integer) $month;
291
+		$day = (integer) $day;
292 292
 
293 293
 		$baseYear = PHPExcel_Shared_Date::getExcelCalendar();
294 294
 		// Validate parameters
295
-		if ($year < ($baseYear-1900)) {
295
+		if ($year < ($baseYear - 1900)) {
296 296
 			return PHPExcel_Calculation_Functions::NaN();
297 297
 		}
298
-		if ((($baseYear-1900) != 0) && ($year < $baseYear) && ($year >= 1900)) {
298
+		if ((($baseYear - 1900) != 0) && ($year < $baseYear) && ($year >= 1900)) {
299 299
 			return PHPExcel_Calculation_Functions::NaN();
300 300
 		}
301 301
 
302
-		if (($year < $baseYear) && ($year >= ($baseYear-1900))) {
302
+		if (($year < $baseYear) && ($year >= ($baseYear - 1900))) {
303 303
 			$year += 1900;
304 304
 		}
305 305
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 *						depending on the value of the ReturnDateType flag
361 361
 	 */
362 362
 	public static function TIME($hour = 0, $minute = 0, $second = 0) {
363
-		$hour	= PHPExcel_Calculation_Functions::flattenSingleValue($hour);
363
+		$hour = PHPExcel_Calculation_Functions::flattenSingleValue($hour);
364 364
 		$minute	= PHPExcel_Calculation_Functions::flattenSingleValue($minute);
365 365
 		$second	= PHPExcel_Calculation_Functions::flattenSingleValue($second);
366 366
 
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 		if ($minute == '') { $minute = 0; }
369 369
 		if ($second == '') { $second = 0; }
370 370
 
371
-		if ((!is_numeric($hour)) || (!is_numeric($minute)) || (!is_numeric($second))) {
371
+		if (( ! is_numeric($hour)) || ( ! is_numeric($minute)) || ( ! is_numeric($second))) {
372 372
 			return PHPExcel_Calculation_Functions::VALUE();
373 373
 		}
374
-		$hour	= (integer) $hour;
374
+		$hour = (integer) $hour;
375 375
 		$minute	= (integer) $minute;
376 376
 		$second	= (integer) $second;
377 377
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 					}
409 409
 					return (float) PHPExcel_Shared_Date::FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
410 410
 			case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC :
411
-					return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::FormattedPHPToExcel(1970, 1, 1, $hour, $minute, $second));	// -2147468400; //	-2147472000 + 3600
411
+					return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::FormattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; //	-2147472000 + 3600
412 412
 			case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT :
413 413
 					$dayAdjust = 0;
414 414
 					if ($hour < 0) {
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
 	 *						depending on the value of the ReturnDateType flag
456 456
 	 */
457 457
 	public static function DATEVALUE($dateValue = 1) {
458
-		$dateValue = trim(PHPExcel_Calculation_Functions::flattenSingleValue($dateValue),'"');
458
+		$dateValue = trim(PHPExcel_Calculation_Functions::flattenSingleValue($dateValue), '"');
459 459
 		//	Strip any ordinals because they're allowed in Excel (English only)
460
-		$dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui','$1$3',$dateValue);
460
+		$dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue);
461 461
 		//	Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany)
462
-		$dateValue	= str_replace(array('/','.','-','  '),array(' ',' ',' ',' '),$dateValue);
462
+		$dateValue	= str_replace(array('/', '.', '-', '  '), array(' ', ' ', ' ', ' '), $dateValue);
463 463
 
464 464
 		$yearFound = false;
465
-		$t1 = explode(' ',$dateValue);
466
-		foreach($t1 as &$t) {
465
+		$t1 = explode(' ', $dateValue);
466
+		foreach ($t1 as &$t) {
467 467
 			if ((is_numeric($t)) && ($t > 31)) {
468 468
 				if ($yearFound) {
469 469
 					return PHPExcel_Calculation_Functions::VALUE();
@@ -473,23 +473,23 @@  discard block
 block discarded – undo
473 473
 				}
474 474
 			}
475 475
 		}
476
-		if ((count($t1) == 1) && (strpos($t,':') != false)) {
476
+		if ((count($t1) == 1) && (strpos($t, ':') != false)) {
477 477
 			//	We've been fed a time value without any date
478 478
 			return 0.0;
479 479
 		} elseif (count($t1) == 2) {
480 480
 			//	We only have two parts of the date: either day/month or month/year
481 481
 			if ($yearFound) {
482
-				array_unshift($t1,1);
482
+				array_unshift($t1, 1);
483 483
 			} else {
484
-				array_push($t1,date('Y'));
484
+				array_push($t1, date('Y'));
485 485
 			}
486 486
 		}
487 487
 		unset($t);
488
-		$dateValue = implode(' ',$t1);
488
+		$dateValue = implode(' ', $t1);
489 489
 
490 490
 		$PHPDateArray = date_parse($dateValue);
491 491
 		if (($PHPDateArray === False) || ($PHPDateArray['error_count'] > 0)) {
492
-			$testVal1 = strtok($dateValue,'- ');
492
+			$testVal1 = strtok($dateValue, '- ');
493 493
 			if ($testVal1 !== False) {
494 494
 				$testVal2 = strtok('- ');
495 495
 				if ($testVal2 !== False) {
@@ -514,12 +514,12 @@  discard block
 block discarded – undo
514 514
 
515 515
 		if (($PHPDateArray !== False) && ($PHPDateArray['error_count'] == 0)) {
516 516
 			// Execute function
517
-			if ($PHPDateArray['year'] == '')	{ $PHPDateArray['year'] = strftime('%Y'); }
517
+			if ($PHPDateArray['year'] == '') { $PHPDateArray['year'] = strftime('%Y'); }
518 518
 			if ($PHPDateArray['year'] < 1900)
519 519
 				return PHPExcel_Calculation_Functions::VALUE();
520
-			if ($PHPDateArray['month'] == '')	{ $PHPDateArray['month'] = strftime('%m'); }
521
-			if ($PHPDateArray['day'] == '')		{ $PHPDateArray['day'] = strftime('%d'); }
522
-			$excelDateValue = floor(PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']));
520
+			if ($PHPDateArray['month'] == '') { $PHPDateArray['month'] = strftime('%m'); }
521
+			if ($PHPDateArray['day'] == '') { $PHPDateArray['day'] = strftime('%d'); }
522
+			$excelDateValue = floor(PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'], $PHPDateArray['month'], $PHPDateArray['day'], $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']));
523 523
 
524 524
 			switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
525 525
 				case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL :
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 	 *						depending on the value of the ReturnDateType flag
558 558
 	 */
559 559
 	public static function TIMEVALUE($timeValue) {
560
-		$timeValue = trim(PHPExcel_Calculation_Functions::flattenSingleValue($timeValue),'"');
561
-		$timeValue	= str_replace(array('/','.'),array('-','-'),$timeValue);
560
+		$timeValue = trim(PHPExcel_Calculation_Functions::flattenSingleValue($timeValue), '"');
561
+		$timeValue	= str_replace(array('/', '.'), array('-', '-'), $timeValue);
562 562
 
563 563
 		$PHPDateArray = date_parse($timeValue);
564 564
 		if (($PHPDateArray !== False) && ($PHPDateArray['error_count'] == 0)) {
565 565
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
566
-				$excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']);
566
+				$excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'], $PHPDateArray['month'], $PHPDateArray['day'], $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']);
567 567
 			} else {
568
-				$excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel(1900,1,1,$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']) - 1;
568
+				$excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1;
569 569
 			}
570 570
 
571 571
 			switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
572 572
 				case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL :
573 573
 						return (float) $excelDateValue;
574 574
 				case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC :
575
-						return (integer) $phpDateValue = PHPExcel_Shared_Date::ExcelToPHP($excelDateValue+25569) - 3600;;
575
+						return (integer) $phpDateValue = PHPExcel_Shared_Date::ExcelToPHP($excelDateValue + 25569) - 3600; ;
576 576
 				case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT :
577 577
 						return new DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']);
578 578
 			}
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 	 * @return	integer	Interval between the dates
593 593
 	 */
594 594
 	public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D') {
595
-		$startDate	= PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
596
-		$endDate	= PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
597
-		$unit		= strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($unit));
595
+		$startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
596
+		$endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
597
+		$unit = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($unit));
598 598
 
599 599
 		if (is_string($startDate = self::_getDateValue($startDate))) {
600 600
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -710,8 +710,8 @@  discard block
 block discarded – undo
710 710
 	 * @return	integer		Number of days between start date and end date
711 711
 	 */
712 712
 	public static function DAYS360($startDate = 0, $endDate = 0, $method = false) {
713
-		$startDate	= PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
714
-		$endDate	= PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
713
+		$startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
714
+		$endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
715 715
 
716 716
 		if (is_string($startDate = self::_getDateValue($startDate))) {
717 717
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 		$endMonth = $PHPEndDateObject->format('n');
732 732
 		$endYear = $PHPEndDateObject->format('Y');
733 733
 
734
-		return self::_dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, !$method);
734
+		return self::_dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, ! $method);
735 735
 	}	//	function DAYS360()
736 736
 
737 737
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 	 * @return	float	fraction of the year
762 762
 	 */
763 763
 	public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) {
764
-		$startDate	= PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
764
+		$startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
765 765
 		$endDate	= PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
766 766
 		$method		= PHPExcel_Calculation_Functions::flattenSingleValue($method);
767 767
 
@@ -772,12 +772,12 @@  discard block
 block discarded – undo
772 772
 			return PHPExcel_Calculation_Functions::VALUE();
773 773
 		}
774 774
 
775
-		if (((is_numeric($method)) && (!is_string($method))) || ($method == '')) {
776
-			switch($method) {
775
+		if (((is_numeric($method)) && ( ! is_string($method))) || ($method == '')) {
776
+			switch ($method) {
777 777
 				case 0	:
778
-					return self::DAYS360($startDate,$endDate) / 360;
778
+					return self::DAYS360($startDate, $endDate) / 360;
779 779
 				case 1	:
780
-					$days = self::DATEDIF($startDate,$endDate);
780
+					$days = self::DATEDIF($startDate, $endDate);
781 781
 					$startYear = self::YEAR($startDate);
782 782
 					$endYear = self::YEAR($endDate);
783 783
 					$years = $endYear - $startYear + 1;
@@ -793,14 +793,14 @@  discard block
 block discarded – undo
793 793
 							}
794 794
 						}
795 795
 					} else {
796
-						for($year = $startYear; $year <= $endYear; ++$year) {
796
+						for ($year = $startYear; $year <= $endYear; ++$year) {
797 797
 							if ($year == $startYear) {
798 798
 								$startMonth = self::MONTHOFYEAR($startDate);
799 799
 								$startDay = self::DAYOFMONTH($startDate);
800 800
 								if ($startMonth < 3) {
801 801
 									$leapDays += (self::_isLeapYear($year)) ? 1 : 0;
802 802
 								}
803
-							} elseif($year == $endYear) {
803
+							} elseif ($year == $endYear) {
804 804
 								$endMonth = self::MONTHOFYEAR($endDate);
805 805
 								$endDay = self::DAYOFMONTH($endDate);
806 806
 								if (($endMonth * 100 + $endDay) >= (2 * 100 + 29)) {
@@ -821,11 +821,11 @@  discard block
 block discarded – undo
821 821
 					}
822 822
 					return $days / (365 + $leapDays);
823 823
 				case 2	:
824
-					return self::DATEDIF($startDate,$endDate) / 360;
824
+					return self::DATEDIF($startDate, $endDate) / 360;
825 825
 				case 3	:
826
-					return self::DATEDIF($startDate,$endDate) / 365;
826
+					return self::DATEDIF($startDate, $endDate) / 365;
827 827
 				case 4	:
828
-					return self::DAYS360($startDate,$endDate,True) / 360;
828
+					return self::DAYS360($startDate, $endDate, True) / 360;
829 829
 			}
830 830
 		}
831 831
 		return PHPExcel_Calculation_Functions::VALUE();
@@ -855,10 +855,10 @@  discard block
 block discarded – undo
855 855
 	 *											as state and federal holidays and floating holidays.
856 856
 	 * @return	integer			Interval between the dates
857 857
 	 */
858
-	public static function NETWORKDAYS($startDate,$endDate) {
858
+	public static function NETWORKDAYS($startDate, $endDate) {
859 859
 		//	Retrieve the mandatory start and end date that are referenced in the function definition
860
-		$startDate	= PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
861
-		$endDate	= PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
860
+		$startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
861
+		$endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
862 862
 		//	Flush the mandatory start and end date that are referenced in the function definition, and get the optional days
863 863
 		$dateArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
864 864
 		array_shift($dateArgs);
@@ -880,9 +880,9 @@  discard block
 block discarded – undo
880 880
 		}
881 881
 
882 882
 		// Execute function
883
-		$startDoW = 6 - self::DAYOFWEEK($startDate,2);
883
+		$startDoW = 6 - self::DAYOFWEEK($startDate, 2);
884 884
 		if ($startDoW < 0) { $startDoW = 0; }
885
-		$endDoW = self::DAYOFWEEK($endDate,2);
885
+		$endDoW = self::DAYOFWEEK($endDate, 2);
886 886
 		if ($endDoW >= 6) { $endDoW = 0; }
887 887
 
888 888
 		$wholeWeekDays = floor(($endDate - $startDate) / 7) * 5;
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 				return PHPExcel_Calculation_Functions::VALUE();
899 899
 			}
900 900
 			if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
901
-				if ((self::DAYOFWEEK($holidayDate,2) < 6) && (!in_array($holidayDate,$holidayCountedArray))) {
901
+				if ((self::DAYOFWEEK($holidayDate, 2) < 6) && ( ! in_array($holidayDate, $holidayCountedArray))) {
902 902
 					--$partWeekDays;
903 903
 					$holidayCountedArray[] = $holidayDate;
904 904
 				}
@@ -937,16 +937,16 @@  discard block
 block discarded – undo
937 937
 	 * @return	mixed	Excel date/time serial value, PHP date/time serial value or PHP date/time object,
938 938
 	 *						depending on the value of the ReturnDateType flag
939 939
 	 */
940
-	public static function WORKDAY($startDate,$endDays) {
940
+	public static function WORKDAY($startDate, $endDays) {
941 941
 		//	Retrieve the mandatory start date and days that are referenced in the function definition
942
-		$startDate	= PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
943
-		$endDays	= PHPExcel_Calculation_Functions::flattenSingleValue($endDays);
942
+		$startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
943
+		$endDays = PHPExcel_Calculation_Functions::flattenSingleValue($endDays);
944 944
 		//	Flush the mandatory start date and days that are referenced in the function definition, and get the optional days
945 945
 		$dateArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
946 946
 		array_shift($dateArgs);
947 947
 		array_shift($dateArgs);
948 948
 
949
-		if ((is_string($startDate = self::_getDateValue($startDate))) || (!is_numeric($endDays))) {
949
+		if ((is_string($startDate = self::_getDateValue($startDate))) || ( ! is_numeric($endDays))) {
950 950
 			return PHPExcel_Calculation_Functions::VALUE();
951 951
 		}
952 952
 		$startDate = (float) floor($startDate);
@@ -958,9 +958,9 @@  discard block
 block discarded – undo
958 958
 
959 959
 		//	Adjust the start date if it falls over a weekend
960 960
 
961
-		$startDoW = self::DAYOFWEEK($startDate,3);
962
-		if (self::DAYOFWEEK($startDate,3) >= 5) {
963
-			$startDate += ($decrementing) ? -$startDoW + 4: 7 - $startDoW;
961
+		$startDoW = self::DAYOFWEEK($startDate, 3);
962
+		if (self::DAYOFWEEK($startDate, 3) >= 5) {
963
+			$startDate += ($decrementing) ? -$startDoW + 4 : 7 - $startDoW;
964 964
 			($decrementing) ? $endDays++ : $endDays--;
965 965
 		}
966 966
 
@@ -968,20 +968,20 @@  discard block
 block discarded – undo
968 968
 		$endDate = (float) $startDate + (intval($endDays / 5) * 7) + ($endDays % 5);
969 969
 
970 970
 		//	Adjust the calculated end date if it falls over a weekend
971
-		$endDoW = self::DAYOFWEEK($endDate,3);
971
+		$endDoW = self::DAYOFWEEK($endDate, 3);
972 972
 		if ($endDoW >= 5) {
973
-			$endDate += ($decrementing) ? -$endDoW + 4: 7 - $endDoW;
973
+			$endDate += ($decrementing) ? -$endDoW + 4 : 7 - $endDoW;
974 974
 		}
975 975
 
976 976
 		//	Test any extra holiday parameters
977
-		if (!empty($dateArgs)) {
977
+		if ( ! empty($dateArgs)) {
978 978
 			$holidayCountedArray = $holidayDates = array();
979 979
 			foreach ($dateArgs as $holidayDate) {
980 980
 				if (($holidayDate !== NULL) && (trim($holidayDate) > '')) {
981 981
 					if (is_string($holidayDate = self::_getDateValue($holidayDate))) {
982 982
 						return PHPExcel_Calculation_Functions::VALUE();
983 983
 					}
984
-					if (self::DAYOFWEEK($holidayDate,3) < 5) {
984
+					if (self::DAYOFWEEK($holidayDate, 3) < 5) {
985 985
 						$holidayDates[] = $holidayDate;
986 986
 					}
987 987
 				}
@@ -994,23 +994,23 @@  discard block
 block discarded – undo
994 994
 			foreach ($holidayDates as $holidayDate) {
995 995
 				if ($decrementing) {
996 996
 					if (($holidayDate <= $startDate) && ($holidayDate >= $endDate)) {
997
-						if (!in_array($holidayDate,$holidayCountedArray)) {
997
+						if ( ! in_array($holidayDate, $holidayCountedArray)) {
998 998
 							--$endDate;
999 999
 							$holidayCountedArray[] = $holidayDate;
1000 1000
 						}
1001 1001
 					}
1002 1002
 				} else {
1003 1003
 					if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
1004
-						if (!in_array($holidayDate,$holidayCountedArray)) {
1004
+						if ( ! in_array($holidayDate, $holidayCountedArray)) {
1005 1005
 							++$endDate;
1006 1006
 							$holidayCountedArray[] = $holidayDate;
1007 1007
 						}
1008 1008
 					}
1009 1009
 				}
1010 1010
 				//	Adjust the calculated end date if it falls over a weekend
1011
-				$endDoW = self::DAYOFWEEK($endDate,3);
1011
+				$endDoW = self::DAYOFWEEK($endDate, 3);
1012 1012
 				if ($endDoW >= 5) {
1013
-					$endDate += ($decrementing) ? -$endDoW + 4: 7 - $endDoW;
1013
+					$endDate += ($decrementing) ? -$endDoW + 4 : 7 - $endDoW;
1014 1014
 				}
1015 1015
 
1016 1016
 			}
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 	 * @return	int		Day of the month
1042 1042
 	 */
1043 1043
 	public static function DAYOFMONTH($dateValue = 1) {
1044
-		$dateValue	= PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1044
+		$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1045 1045
 
1046 1046
 		if (is_string($dateValue = self::_getDateValue($dateValue))) {
1047 1047
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -1076,10 +1076,10 @@  discard block
 block discarded – undo
1076 1076
 	 * @return	int		Day of the week value
1077 1077
 	 */
1078 1078
 	public static function DAYOFWEEK($dateValue = 1, $style = 1) {
1079
-		$dateValue	= PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1080
-		$style		= PHPExcel_Calculation_Functions::flattenSingleValue($style);
1079
+		$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1080
+		$style = PHPExcel_Calculation_Functions::flattenSingleValue($style);
1081 1081
 
1082
-		if (!is_numeric($style)) {
1082
+		if ( ! is_numeric($style)) {
1083 1083
 			return PHPExcel_Calculation_Functions::VALUE();
1084 1084
 		} elseif (($style < 1) || ($style > 3)) {
1085 1085
 			return PHPExcel_Calculation_Functions::NaN();
@@ -1142,10 +1142,10 @@  discard block
 block discarded – undo
1142 1142
 	 * @return	int		Week Number
1143 1143
 	 */
1144 1144
 	public static function WEEKOFYEAR($dateValue = 1, $method = 1) {
1145
-		$dateValue	= PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1146
-		$method		= PHPExcel_Calculation_Functions::flattenSingleValue($method);
1145
+		$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1146
+		$method = PHPExcel_Calculation_Functions::flattenSingleValue($method);
1147 1147
 
1148
-		if (!is_numeric($method)) {
1148
+		if ( ! is_numeric($method)) {
1149 1149
 			return PHPExcel_Calculation_Functions::VALUE();
1150 1150
 		} elseif (($method < 1) || ($method > 2)) {
1151 1151
 			return PHPExcel_Calculation_Functions::NaN();
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 	 * @return	int		Month of the year
1187 1187
 	 */
1188 1188
 	public static function MONTHOFYEAR($dateValue = 1) {
1189
-		$dateValue	= PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1189
+		$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1190 1190
 
1191 1191
 		if (is_string($dateValue = self::_getDateValue($dateValue))) {
1192 1192
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
 	 * @return	int		Year
1216 1216
 	 */
1217 1217
 	public static function YEAR($dateValue = 1) {
1218
-		$dateValue	= PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1218
+		$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1219 1219
 
1220 1220
 		if (is_string($dateValue = self::_getDateValue($dateValue))) {
1221 1221
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -1244,11 +1244,11 @@  discard block
 block discarded – undo
1244 1244
 	 * @return	int		Hour
1245 1245
 	 */
1246 1246
 	public static function HOUROFDAY($timeValue = 0) {
1247
-		$timeValue	= PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
1247
+		$timeValue = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
1248 1248
 
1249
-		if (!is_numeric($timeValue)) {
1249
+		if ( ! is_numeric($timeValue)) {
1250 1250
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
1251
-				$testVal = strtok($timeValue,'/-: ');
1251
+				$testVal = strtok($timeValue, '/-: ');
1252 1252
 				if (strlen($testVal) < strlen($timeValue)) {
1253 1253
 					return PHPExcel_Calculation_Functions::VALUE();
1254 1254
 				}
@@ -1260,13 +1260,13 @@  discard block
 block discarded – undo
1260 1260
 		}
1261 1261
 		// Execute function
1262 1262
 		if ($timeValue >= 1) {
1263
-			$timeValue = fmod($timeValue,1);
1263
+			$timeValue = fmod($timeValue, 1);
1264 1264
 		} elseif ($timeValue < 0.0) {
1265 1265
 			return PHPExcel_Calculation_Functions::NaN();
1266 1266
 		}
1267 1267
 		$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
1268 1268
 
1269
-		return (int) gmdate('G',$timeValue);
1269
+		return (int) gmdate('G', $timeValue);
1270 1270
 	}	//	function HOUROFDAY()
1271 1271
 
1272 1272
 
@@ -1284,11 +1284,11 @@  discard block
 block discarded – undo
1284 1284
 	 * @return	int		Minute
1285 1285
 	 */
1286 1286
 	public static function MINUTEOFHOUR($timeValue = 0) {
1287
-		$timeValue = $timeTester	= PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
1287
+		$timeValue = $timeTester = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
1288 1288
 
1289
-		if (!is_numeric($timeValue)) {
1289
+		if ( ! is_numeric($timeValue)) {
1290 1290
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
1291
-				$testVal = strtok($timeValue,'/-: ');
1291
+				$testVal = strtok($timeValue, '/-: ');
1292 1292
 				if (strlen($testVal) < strlen($timeValue)) {
1293 1293
 					return PHPExcel_Calculation_Functions::VALUE();
1294 1294
 				}
@@ -1300,13 +1300,13 @@  discard block
 block discarded – undo
1300 1300
 		}
1301 1301
 		// Execute function
1302 1302
 		if ($timeValue >= 1) {
1303
-			$timeValue = fmod($timeValue,1);
1303
+			$timeValue = fmod($timeValue, 1);
1304 1304
 		} elseif ($timeValue < 0.0) {
1305 1305
 			return PHPExcel_Calculation_Functions::NaN();
1306 1306
 		}
1307 1307
 		$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
1308 1308
 
1309
-		return (int) gmdate('i',$timeValue);
1309
+		return (int) gmdate('i', $timeValue);
1310 1310
 	}	//	function MINUTEOFHOUR()
1311 1311
 
1312 1312
 
@@ -1324,11 +1324,11 @@  discard block
 block discarded – undo
1324 1324
 	 * @return	int		Second
1325 1325
 	 */
1326 1326
 	public static function SECONDOFMINUTE($timeValue = 0) {
1327
-		$timeValue	= PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
1327
+		$timeValue = PHPExcel_Calculation_Functions::flattenSingleValue($timeValue);
1328 1328
 
1329
-		if (!is_numeric($timeValue)) {
1329
+		if ( ! is_numeric($timeValue)) {
1330 1330
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
1331
-				$testVal = strtok($timeValue,'/-: ');
1331
+				$testVal = strtok($timeValue, '/-: ');
1332 1332
 				if (strlen($testVal) < strlen($timeValue)) {
1333 1333
 					return PHPExcel_Calculation_Functions::VALUE();
1334 1334
 				}
@@ -1340,13 +1340,13 @@  discard block
 block discarded – undo
1340 1340
 		}
1341 1341
 		// Execute function
1342 1342
 		if ($timeValue >= 1) {
1343
-			$timeValue = fmod($timeValue,1);
1343
+			$timeValue = fmod($timeValue, 1);
1344 1344
 		} elseif ($timeValue < 0.0) {
1345 1345
 			return PHPExcel_Calculation_Functions::NaN();
1346 1346
 		}
1347 1347
 		$timeValue = PHPExcel_Shared_Date::ExcelToPHP($timeValue);
1348 1348
 
1349
-		return (int) gmdate('s',$timeValue);
1349
+		return (int) gmdate('s', $timeValue);
1350 1350
 	}	//	function SECONDOFMINUTE()
1351 1351
 
1352 1352
 
@@ -1370,10 +1370,10 @@  discard block
 block discarded – undo
1370 1370
 	 *						depending on the value of the ReturnDateType flag
1371 1371
 	 */
1372 1372
 	public static function EDATE($dateValue = 1, $adjustmentMonths = 0) {
1373
-		$dateValue			= PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1374
-		$adjustmentMonths	= PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
1373
+		$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1374
+		$adjustmentMonths = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
1375 1375
 
1376
-		if (!is_numeric($adjustmentMonths)) {
1376
+		if ( ! is_numeric($adjustmentMonths)) {
1377 1377
 			return PHPExcel_Calculation_Functions::VALUE();
1378 1378
 		}
1379 1379
 		$adjustmentMonths = floor($adjustmentMonths);
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 		}
1384 1384
 
1385 1385
 		// Execute function
1386
-		$PHPDateObject = self::_adjustDateByMonths($dateValue,$adjustmentMonths);
1386
+		$PHPDateObject = self::_adjustDateByMonths($dateValue, $adjustmentMonths);
1387 1387
 
1388 1388
 		switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
1389 1389
 			case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL :
@@ -1415,10 +1415,10 @@  discard block
 block discarded – undo
1415 1415
 	 *						depending on the value of the ReturnDateType flag
1416 1416
 	 */
1417 1417
 	public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) {
1418
-		$dateValue			= PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1419
-		$adjustmentMonths	= PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
1418
+		$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
1419
+		$adjustmentMonths = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
1420 1420
 
1421
-		if (!is_numeric($adjustmentMonths)) {
1421
+		if ( ! is_numeric($adjustmentMonths)) {
1422 1422
 			return PHPExcel_Calculation_Functions::VALUE();
1423 1423
 		}
1424 1424
 		$adjustmentMonths = floor($adjustmentMonths);
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 		}
1429 1429
 
1430 1430
 		// Execute function
1431
-		$PHPDateObject = self::_adjustDateByMonths($dateValue,$adjustmentMonths+1);
1431
+		$PHPDateObject = self::_adjustDateByMonths($dateValue, $adjustmentMonths + 1);
1432 1432
 		$adjustDays = (int) $PHPDateObject->format('d');
1433 1433
 		$adjustDaysString = '-'.$adjustDays.' days';
1434 1434
 		$PHPDateObject->modify($adjustDaysString);
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -515,8 +515,9 @@  discard block
 block discarded – undo
515 515
 		if (($PHPDateArray !== False) && ($PHPDateArray['error_count'] == 0)) {
516 516
 			// Execute function
517 517
 			if ($PHPDateArray['year'] == '')	{ $PHPDateArray['year'] = strftime('%Y'); }
518
-			if ($PHPDateArray['year'] < 1900)
519
-				return PHPExcel_Calculation_Functions::VALUE();
518
+			if ($PHPDateArray['year'] < 1900) {
519
+							return PHPExcel_Calculation_Functions::VALUE();
520
+			}
520 521
 			if ($PHPDateArray['month'] == '')	{ $PHPDateArray['month'] = strftime('%m'); }
521 522
 			if ($PHPDateArray['day'] == '')		{ $PHPDateArray['day'] = strftime('%d'); }
522 523
 			$excelDateValue = floor(PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']));
@@ -656,7 +657,9 @@  discard block
 block discarded – undo
656 657
 				break;
657 658
 			case 'YM':
658 659
 				$retVal = intval($endMonths - $startMonths);
659
-				if ($retVal < 0) $retVal = 12 + $retVal;
660
+				if ($retVal < 0) {
661
+					$retVal = 12 + $retVal;
662
+				}
660 663
 				//	We're only interested in full months
661 664
 				if ($endDays < $startDays) {
662 665
 					--$retVal;
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Calculation/Engineering.php 3 patches
Doc Comments   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -757,6 +757,9 @@  discard block
 block discarded – undo
757 757
 	}
758 758
 
759 759
 
760
+	/**
761
+	 * @param string $xVal
762
+	 */
760 763
 	private static function _nbrConversionFormat($xVal,$places) {
761 764
 		if (!is_null($places)) {
762 765
 			if (strlen($xVal) <= $places) {
@@ -1716,7 +1719,7 @@  discard block
 block discarded – undo
1716 1719
 	 * @access	public
1717 1720
 	 * @category Engineering Functions
1718 1721
 	 * @param	string		$complexNumber	The complex number for which you want the real coefficient.
1719
-	 * @return	float
1722
+	 * @return	string
1720 1723
 	 */
1721 1724
 	public static function IMREAL($complexNumber) {
1722 1725
 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
@@ -2121,7 +2124,6 @@  discard block
 block discarded – undo
2121 2124
 	 * Excel Function:
2122 2125
 	 *		IMSUM(complexNumber[,complexNumber[,...]])
2123 2126
 	 *
2124
-	 * @param	string		$complexNumber,...	Series of complex numbers to add
2125 2127
 	 * @return	string
2126 2128
 	 */
2127 2129
 	public static function IMSUM() {
@@ -2157,7 +2159,6 @@  discard block
 block discarded – undo
2157 2159
 	 * Excel Function:
2158 2160
 	 *		IMPRODUCT(complexNumber[,complexNumber[,...]])
2159 2161
 	 *
2160
-	 * @param	string		$complexNumber,...	Series of complex numbers to multiply
2161 2162
 	 * @return	string
2162 2163
 	 */
2163 2164
 	public static function IMPRODUCT() {
@@ -2197,7 +2198,7 @@  discard block
 block discarded – undo
2197 2198
 	 *		DELTA(a[,b])
2198 2199
 	 *
2199 2200
 	 * @param	float		$a	The first number.
2200
-	 * @param	float		$b	The second number. If omitted, b is assumed to be zero.
2201
+	 * @param	integer		$b	The second number. If omitted, b is assumed to be zero.
2201 2202
 	 * @return	int
2202 2203
 	 */
2203 2204
 	public static function DELTA($a, $b=0) {
@@ -2219,7 +2220,7 @@  discard block
 block discarded – undo
2219 2220
 	 * functions you calculate the count of values that exceed a threshold.
2220 2221
 	 *
2221 2222
 	 * @param	float		$number		The value to test against step.
2222
-	 * @param	float		$step		The threshold value.
2223
+	 * @param	integer		$step		The threshold value.
2223 2224
 	 *									If you omit a value for step, GESTEP uses zero.
2224 2225
 	 * @return	int
2225 2226
 	 */
Please login to merge, or discard this patch.
Spacing   +285 added lines, -285 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
 
29 29
 /** PHPExcel root directory */
30
-if (!defined('PHPEXCEL_ROOT')) {
30
+if ( ! defined('PHPEXCEL_ROOT')) {
31 31
 	/**
32 32
 	 * @ignore
33 33
 	 */
34
-	define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
35
-	require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
34
+	define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../');
35
+	require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php');
36 36
 }
37 37
 
38 38
 
@@ -54,69 +54,69 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @var mixed[]
56 56
 	 */
57
-	private static $_conversionUnits = array( 'g'		=> array(	'Group'	=> 'Mass',			'Unit Name'	=> 'Gram',						'AllowPrefix'	=> True		),
58
-											  'sg'		=> array(	'Group'	=> 'Mass',			'Unit Name'	=> 'Slug',						'AllowPrefix'	=> False	),
59
-											  'lbm'		=> array(	'Group'	=> 'Mass',			'Unit Name'	=> 'Pound mass (avoirdupois)',	'AllowPrefix'	=> False	),
60
-											  'u'		=> array(	'Group'	=> 'Mass',			'Unit Name'	=> 'U (atomic mass unit)',		'AllowPrefix'	=> True		),
61
-											  'ozm'		=> array(	'Group'	=> 'Mass',			'Unit Name'	=> 'Ounce mass (avoirdupois)',	'AllowPrefix'	=> False	),
62
-											  'm'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Meter',						'AllowPrefix'	=> True		),
63
-											  'mi'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Statute mile',				'AllowPrefix'	=> False	),
64
-											  'Nmi'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Nautical mile',				'AllowPrefix'	=> False	),
65
-											  'in'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Inch',						'AllowPrefix'	=> False	),
66
-											  'ft'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Foot',						'AllowPrefix'	=> False	),
67
-											  'yd'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Yard',						'AllowPrefix'	=> False	),
68
-											  'ang'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Angstrom',					'AllowPrefix'	=> True		),
69
-											  'Pica'	=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Pica (1/72 in)',			'AllowPrefix'	=> False	),
70
-											  'yr'		=> array(	'Group'	=> 'Time',			'Unit Name'	=> 'Year',						'AllowPrefix'	=> False	),
71
-											  'day'		=> array(	'Group'	=> 'Time',			'Unit Name'	=> 'Day',						'AllowPrefix'	=> False	),
72
-											  'hr'		=> array(	'Group'	=> 'Time',			'Unit Name'	=> 'Hour',						'AllowPrefix'	=> False	),
73
-											  'mn'		=> array(	'Group'	=> 'Time',			'Unit Name'	=> 'Minute',					'AllowPrefix'	=> False	),
74
-											  'sec'		=> array(	'Group'	=> 'Time',			'Unit Name'	=> 'Second',					'AllowPrefix'	=> True		),
75
-											  'Pa'		=> array(	'Group'	=> 'Pressure',		'Unit Name'	=> 'Pascal',					'AllowPrefix'	=> True		),
76
-											  'p'		=> array(	'Group'	=> 'Pressure',		'Unit Name'	=> 'Pascal',					'AllowPrefix'	=> True		),
77
-											  'atm'		=> array(	'Group'	=> 'Pressure',		'Unit Name'	=> 'Atmosphere',				'AllowPrefix'	=> True		),
78
-											  'at'		=> array(	'Group'	=> 'Pressure',		'Unit Name'	=> 'Atmosphere',				'AllowPrefix'	=> True		),
79
-											  'mmHg'	=> array(	'Group'	=> 'Pressure',		'Unit Name'	=> 'mm of Mercury',				'AllowPrefix'	=> True		),
80
-											  'N'		=> array(	'Group'	=> 'Force',			'Unit Name'	=> 'Newton',					'AllowPrefix'	=> True		),
81
-											  'dyn'		=> array(	'Group'	=> 'Force',			'Unit Name'	=> 'Dyne',						'AllowPrefix'	=> True		),
82
-											  'dy'		=> array(	'Group'	=> 'Force',			'Unit Name'	=> 'Dyne',						'AllowPrefix'	=> True		),
83
-											  'lbf'		=> array(	'Group'	=> 'Force',			'Unit Name'	=> 'Pound force',				'AllowPrefix'	=> False	),
84
-											  'J'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Joule',						'AllowPrefix'	=> True		),
85
-											  'e'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Erg',						'AllowPrefix'	=> True		),
86
-											  'c'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Thermodynamic calorie',		'AllowPrefix'	=> True		),
87
-											  'cal'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'IT calorie',				'AllowPrefix'	=> True		),
88
-											  'eV'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Electron volt',				'AllowPrefix'	=> True		),
89
-											  'ev'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Electron volt',				'AllowPrefix'	=> True		),
90
-											  'HPh'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Horsepower-hour',			'AllowPrefix'	=> False	),
91
-											  'hh'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Horsepower-hour',			'AllowPrefix'	=> False	),
92
-											  'Wh'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Watt-hour',					'AllowPrefix'	=> True		),
93
-											  'wh'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Watt-hour',					'AllowPrefix'	=> True		),
94
-											  'flb'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Foot-pound',				'AllowPrefix'	=> False	),
95
-											  'BTU'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'BTU',						'AllowPrefix'	=> False	),
96
-											  'btu'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'BTU',						'AllowPrefix'	=> False	),
97
-											  'HP'		=> array(	'Group'	=> 'Power',			'Unit Name'	=> 'Horsepower',				'AllowPrefix'	=> False	),
98
-											  'h'		=> array(	'Group'	=> 'Power',			'Unit Name'	=> 'Horsepower',				'AllowPrefix'	=> False	),
99
-											  'W'		=> array(	'Group'	=> 'Power',			'Unit Name'	=> 'Watt',						'AllowPrefix'	=> True		),
100
-											  'w'		=> array(	'Group'	=> 'Power',			'Unit Name'	=> 'Watt',						'AllowPrefix'	=> True		),
101
-											  'T'		=> array(	'Group'	=> 'Magnetism',		'Unit Name'	=> 'Tesla',						'AllowPrefix'	=> True		),
102
-											  'ga'		=> array(	'Group'	=> 'Magnetism',		'Unit Name'	=> 'Gauss',						'AllowPrefix'	=> True		),
103
-											  'C'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Celsius',					'AllowPrefix'	=> False	),
104
-											  'cel'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Celsius',					'AllowPrefix'	=> False	),
105
-											  'F'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Fahrenheit',				'AllowPrefix'	=> False	),
106
-											  'fah'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Fahrenheit',				'AllowPrefix'	=> False	),
107
-											  'K'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Kelvin',					'AllowPrefix'	=> False	),
108
-											  'kel'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Kelvin',					'AllowPrefix'	=> False	),
109
-											  'tsp'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Teaspoon',					'AllowPrefix'	=> False	),
110
-											  'tbs'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Tablespoon',				'AllowPrefix'	=> False	),
111
-											  'oz'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Fluid Ounce',				'AllowPrefix'	=> False	),
112
-											  'cup'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Cup',						'AllowPrefix'	=> False	),
113
-											  'pt'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'U.S. Pint',					'AllowPrefix'	=> False	),
114
-											  'us_pt'	=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'U.S. Pint',					'AllowPrefix'	=> False	),
115
-											  'uk_pt'	=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'U.K. Pint',					'AllowPrefix'	=> False	),
116
-											  'qt'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Quart',						'AllowPrefix'	=> False	),
117
-											  'gal'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Gallon',					'AllowPrefix'	=> False	),
118
-											  'l'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Litre',						'AllowPrefix'	=> True		),
119
-											  'lt'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Litre',						'AllowPrefix'	=> True		)
57
+	private static $_conversionUnits = array('g'		=> array('Group'	=> 'Mass', 'Unit Name'	=> 'Gram', 'AllowPrefix'	=> True),
58
+											  'sg'		=> array('Group'	=> 'Mass', 'Unit Name'	=> 'Slug', 'AllowPrefix'	=> False),
59
+											  'lbm'		=> array('Group'	=> 'Mass', 'Unit Name'	=> 'Pound mass (avoirdupois)', 'AllowPrefix'	=> False),
60
+											  'u'		=> array('Group'	=> 'Mass', 'Unit Name'	=> 'U (atomic mass unit)', 'AllowPrefix'	=> True),
61
+											  'ozm'		=> array('Group'	=> 'Mass', 'Unit Name'	=> 'Ounce mass (avoirdupois)', 'AllowPrefix'	=> False),
62
+											  'm'		=> array('Group'	=> 'Distance', 'Unit Name'	=> 'Meter', 'AllowPrefix'	=> True),
63
+											  'mi'		=> array('Group'	=> 'Distance', 'Unit Name'	=> 'Statute mile', 'AllowPrefix'	=> False),
64
+											  'Nmi'		=> array('Group'	=> 'Distance', 'Unit Name'	=> 'Nautical mile', 'AllowPrefix'	=> False),
65
+											  'in'		=> array('Group'	=> 'Distance', 'Unit Name'	=> 'Inch', 'AllowPrefix'	=> False),
66
+											  'ft'		=> array('Group'	=> 'Distance', 'Unit Name'	=> 'Foot', 'AllowPrefix'	=> False),
67
+											  'yd'		=> array('Group'	=> 'Distance', 'Unit Name'	=> 'Yard', 'AllowPrefix'	=> False),
68
+											  'ang'		=> array('Group'	=> 'Distance', 'Unit Name'	=> 'Angstrom', 'AllowPrefix'	=> True),
69
+											  'Pica'	=> array('Group'	=> 'Distance', 'Unit Name'	=> 'Pica (1/72 in)', 'AllowPrefix'	=> False),
70
+											  'yr'		=> array('Group'	=> 'Time', 'Unit Name'	=> 'Year', 'AllowPrefix'	=> False),
71
+											  'day'		=> array('Group'	=> 'Time', 'Unit Name'	=> 'Day', 'AllowPrefix'	=> False),
72
+											  'hr'		=> array('Group'	=> 'Time', 'Unit Name'	=> 'Hour', 'AllowPrefix'	=> False),
73
+											  'mn'		=> array('Group'	=> 'Time', 'Unit Name'	=> 'Minute', 'AllowPrefix'	=> False),
74
+											  'sec'		=> array('Group'	=> 'Time', 'Unit Name'	=> 'Second', 'AllowPrefix'	=> True),
75
+											  'Pa'		=> array('Group'	=> 'Pressure', 'Unit Name'	=> 'Pascal', 'AllowPrefix'	=> True),
76
+											  'p'		=> array('Group'	=> 'Pressure', 'Unit Name'	=> 'Pascal', 'AllowPrefix'	=> True),
77
+											  'atm'		=> array('Group'	=> 'Pressure', 'Unit Name'	=> 'Atmosphere', 'AllowPrefix'	=> True),
78
+											  'at'		=> array('Group'	=> 'Pressure', 'Unit Name'	=> 'Atmosphere', 'AllowPrefix'	=> True),
79
+											  'mmHg'	=> array('Group'	=> 'Pressure', 'Unit Name'	=> 'mm of Mercury', 'AllowPrefix'	=> True),
80
+											  'N'		=> array('Group'	=> 'Force', 'Unit Name'	=> 'Newton', 'AllowPrefix'	=> True),
81
+											  'dyn'		=> array('Group'	=> 'Force', 'Unit Name'	=> 'Dyne', 'AllowPrefix'	=> True),
82
+											  'dy'		=> array('Group'	=> 'Force', 'Unit Name'	=> 'Dyne', 'AllowPrefix'	=> True),
83
+											  'lbf'		=> array('Group'	=> 'Force', 'Unit Name'	=> 'Pound force', 'AllowPrefix'	=> False),
84
+											  'J'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'Joule', 'AllowPrefix'	=> True),
85
+											  'e'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'Erg', 'AllowPrefix'	=> True),
86
+											  'c'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'Thermodynamic calorie', 'AllowPrefix'	=> True),
87
+											  'cal'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'IT calorie', 'AllowPrefix'	=> True),
88
+											  'eV'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'Electron volt', 'AllowPrefix'	=> True),
89
+											  'ev'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'Electron volt', 'AllowPrefix'	=> True),
90
+											  'HPh'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'Horsepower-hour', 'AllowPrefix'	=> False),
91
+											  'hh'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'Horsepower-hour', 'AllowPrefix'	=> False),
92
+											  'Wh'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'Watt-hour', 'AllowPrefix'	=> True),
93
+											  'wh'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'Watt-hour', 'AllowPrefix'	=> True),
94
+											  'flb'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'Foot-pound', 'AllowPrefix'	=> False),
95
+											  'BTU'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'BTU', 'AllowPrefix'	=> False),
96
+											  'btu'		=> array('Group'	=> 'Energy', 'Unit Name'	=> 'BTU', 'AllowPrefix'	=> False),
97
+											  'HP'		=> array('Group'	=> 'Power', 'Unit Name'	=> 'Horsepower', 'AllowPrefix'	=> False),
98
+											  'h'		=> array('Group'	=> 'Power', 'Unit Name'	=> 'Horsepower', 'AllowPrefix'	=> False),
99
+											  'W'		=> array('Group'	=> 'Power', 'Unit Name'	=> 'Watt', 'AllowPrefix'	=> True),
100
+											  'w'		=> array('Group'	=> 'Power', 'Unit Name'	=> 'Watt', 'AllowPrefix'	=> True),
101
+											  'T'		=> array('Group'	=> 'Magnetism', 'Unit Name'	=> 'Tesla', 'AllowPrefix'	=> True),
102
+											  'ga'		=> array('Group'	=> 'Magnetism', 'Unit Name'	=> 'Gauss', 'AllowPrefix'	=> True),
103
+											  'C'		=> array('Group'	=> 'Temperature', 'Unit Name'	=> 'Celsius', 'AllowPrefix'	=> False),
104
+											  'cel'		=> array('Group'	=> 'Temperature', 'Unit Name'	=> 'Celsius', 'AllowPrefix'	=> False),
105
+											  'F'		=> array('Group'	=> 'Temperature', 'Unit Name'	=> 'Fahrenheit', 'AllowPrefix'	=> False),
106
+											  'fah'		=> array('Group'	=> 'Temperature', 'Unit Name'	=> 'Fahrenheit', 'AllowPrefix'	=> False),
107
+											  'K'		=> array('Group'	=> 'Temperature', 'Unit Name'	=> 'Kelvin', 'AllowPrefix'	=> False),
108
+											  'kel'		=> array('Group'	=> 'Temperature', 'Unit Name'	=> 'Kelvin', 'AllowPrefix'	=> False),
109
+											  'tsp'		=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'Teaspoon', 'AllowPrefix'	=> False),
110
+											  'tbs'		=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'Tablespoon', 'AllowPrefix'	=> False),
111
+											  'oz'		=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'Fluid Ounce', 'AllowPrefix'	=> False),
112
+											  'cup'		=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'Cup', 'AllowPrefix'	=> False),
113
+											  'pt'		=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'U.S. Pint', 'AllowPrefix'	=> False),
114
+											  'us_pt'	=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'U.S. Pint', 'AllowPrefix'	=> False),
115
+											  'uk_pt'	=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'U.K. Pint', 'AllowPrefix'	=> False),
116
+											  'qt'		=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'Quart', 'AllowPrefix'	=> False),
117
+											  'gal'		=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'Gallon', 'AllowPrefix'	=> False),
118
+											  'l'		=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'Litre', 'AllowPrefix'	=> True),
119
+											  'lt'		=> array('Group'	=> 'Liquid', 'Unit Name'	=> 'Litre', 'AllowPrefix'	=> True)
120 120
 											);
121 121
 
122 122
 	/**
@@ -124,26 +124,26 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @var mixed[]
126 126
 	 */
127
-	private static $_conversionMultipliers = array(	'Y'	=> array(	'multiplier'	=> 1E24,	'name'	=> 'yotta'	),
128
-													'Z'	=> array(	'multiplier'	=> 1E21,	'name'	=> 'zetta'	),
129
-													'E'	=> array(	'multiplier'	=> 1E18,	'name'	=> 'exa'	),
130
-													'P'	=> array(	'multiplier'	=> 1E15,	'name'	=> 'peta'	),
131
-													'T'	=> array(	'multiplier'	=> 1E12,	'name'	=> 'tera'	),
132
-													'G'	=> array(	'multiplier'	=> 1E9,		'name'	=> 'giga'	),
133
-													'M'	=> array(	'multiplier'	=> 1E6,		'name'	=> 'mega'	),
134
-													'k'	=> array(	'multiplier'	=> 1E3,		'name'	=> 'kilo'	),
135
-													'h'	=> array(	'multiplier'	=> 1E2,		'name'	=> 'hecto'	),
136
-													'e'	=> array(	'multiplier'	=> 1E1,		'name'	=> 'deka'	),
137
-													'd'	=> array(	'multiplier'	=> 1E-1,	'name'	=> 'deci'	),
138
-													'c'	=> array(	'multiplier'	=> 1E-2,	'name'	=> 'centi'	),
139
-													'm'	=> array(	'multiplier'	=> 1E-3,	'name'	=> 'milli'	),
140
-													'u'	=> array(	'multiplier'	=> 1E-6,	'name'	=> 'micro'	),
141
-													'n'	=> array(	'multiplier'	=> 1E-9,	'name'	=> 'nano'	),
142
-													'p'	=> array(	'multiplier'	=> 1E-12,	'name'	=> 'pico'	),
143
-													'f'	=> array(	'multiplier'	=> 1E-15,	'name'	=> 'femto'	),
144
-													'a'	=> array(	'multiplier'	=> 1E-18,	'name'	=> 'atto'	),
145
-													'z'	=> array(	'multiplier'	=> 1E-21,	'name'	=> 'zepto'	),
146
-													'y'	=> array(	'multiplier'	=> 1E-24,	'name'	=> 'yocto'	)
127
+	private static $_conversionMultipliers = array('Y'	=> array('multiplier'	=> 1E24, 'name'	=> 'yotta'),
128
+													'Z'	=> array('multiplier'	=> 1E21, 'name'	=> 'zetta'),
129
+													'E'	=> array('multiplier'	=> 1E18, 'name'	=> 'exa'),
130
+													'P'	=> array('multiplier'	=> 1E15, 'name'	=> 'peta'),
131
+													'T'	=> array('multiplier'	=> 1E12, 'name'	=> 'tera'),
132
+													'G'	=> array('multiplier'	=> 1E9, 'name'	=> 'giga'),
133
+													'M'	=> array('multiplier'	=> 1E6, 'name'	=> 'mega'),
134
+													'k'	=> array('multiplier'	=> 1E3, 'name'	=> 'kilo'),
135
+													'h'	=> array('multiplier'	=> 1E2, 'name'	=> 'hecto'),
136
+													'e'	=> array('multiplier'	=> 1E1, 'name'	=> 'deka'),
137
+													'd'	=> array('multiplier'	=> 1E-1, 'name'	=> 'deci'),
138
+													'c'	=> array('multiplier'	=> 1E-2, 'name'	=> 'centi'),
139
+													'm'	=> array('multiplier'	=> 1E-3, 'name'	=> 'milli'),
140
+													'u'	=> array('multiplier'	=> 1E-6, 'name'	=> 'micro'),
141
+													'n'	=> array('multiplier'	=> 1E-9, 'name'	=> 'nano'),
142
+													'p'	=> array('multiplier'	=> 1E-12, 'name'	=> 'pico'),
143
+													'f'	=> array('multiplier'	=> 1E-15, 'name'	=> 'femto'),
144
+													'a'	=> array('multiplier'	=> 1E-18, 'name'	=> 'atto'),
145
+													'z'	=> array('multiplier'	=> 1E-21, 'name'	=> 'zepto'),
146
+													'y'	=> array('multiplier'	=> 1E-24, 'name'	=> 'yocto')
147 147
 												 );
148 148
 
149 149
 	/**
@@ -151,38 +151,38 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @var mixed[]
153 153
 	 */
154
-	private static $_unitConversions = array(	'Mass'		=> array(	'g'		=> array(	'g'		=> 1.0,
154
+	private static $_unitConversions = array('Mass'		=> array('g'		=> array('g'		=> 1.0,
155 155
 																							'sg'	=> 6.85220500053478E-05,
156 156
 																							'lbm'	=> 2.20462291469134E-03,
157 157
 																							'u'		=> 6.02217000000000E+23,
158 158
 																							'ozm'	=> 3.52739718003627E-02
159 159
 																						),
160
-																		'sg'	=> array(	'g'		=> 1.45938424189287E+04,
160
+																		'sg'	=> array('g'		=> 1.45938424189287E+04,
161 161
 																							'sg'	=> 1.0,
162 162
 																							'lbm'	=> 3.21739194101647E+01,
163 163
 																							'u'		=> 8.78866000000000E+27,
164 164
 																							'ozm'	=> 5.14782785944229E+02
165 165
 																						),
166
-																		'lbm'	=> array(	'g'		=> 4.5359230974881148E+02,
166
+																		'lbm'	=> array('g'		=> 4.5359230974881148E+02,
167 167
 																							'sg'	=> 3.10810749306493E-02,
168 168
 																							'lbm'	=> 1.0,
169 169
 																							'u'		=> 2.73161000000000E+26,
170 170
 																							'ozm'	=> 1.60000023429410E+01
171 171
 																						),
172
-																		'u'		=> array(	'g'		=> 1.66053100460465E-24,
172
+																		'u'		=> array('g'		=> 1.66053100460465E-24,
173 173
 																							'sg'	=> 1.13782988532950E-28,
174 174
 																							'lbm'	=> 3.66084470330684E-27,
175 175
 																							'u'		=> 1.0,
176 176
 																							'ozm'	=> 5.85735238300524E-26
177 177
 																						),
178
-																		'ozm'	=> array(	'g'		=> 2.83495152079732E+01,
178
+																		'ozm'	=> array('g'		=> 2.83495152079732E+01,
179 179
 																							'sg'	=> 1.94256689870811E-03,
180 180
 																							'lbm'	=> 6.24999908478882E-02,
181 181
 																							'u'		=> 1.70725600000000E+25,
182 182
 																							'ozm'	=> 1.0
183 183
 																						)
184 184
 																	),
185
-												'Distance'	=> array(	'm'		=> array(	'm'		=> 1.0,
185
+												'Distance'	=> array('m'		=> array('m'		=> 1.0,
186 186
 																							'mi'	=> 6.21371192237334E-04,
187 187
 																							'Nmi'	=> 5.39956803455724E-04,
188 188
 																							'in'	=> 3.93700787401575E+01,
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 																							'ang'	=> 1.00000000000000E+10,
192 192
 																							'Pica'	=> 2.83464566929116E+03
193 193
 																						),
194
-																		'mi'	=> array(	'm'		=> 1.60934400000000E+03,
194
+																		'mi'	=> array('m'		=> 1.60934400000000E+03,
195 195
 																							'mi'	=> 1.0,
196 196
 																							'Nmi'	=> 8.68976241900648E-01,
197 197
 																							'in'	=> 6.33600000000000E+04,
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 																							'ang'	=> 1.60934400000000E+13,
201 201
 																							'Pica'	=> 4.56191999999971E+06
202 202
 																						),
203
-																		'Nmi'	=> array(	'm'		=> 1.85200000000000E+03,
203
+																		'Nmi'	=> array('m'		=> 1.85200000000000E+03,
204 204
 																							'mi'	=> 1.15077944802354E+00,
205 205
 																							'Nmi'	=> 1.0,
206 206
 																							'in'	=> 7.29133858267717E+04,
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 																							'ang'	=> 1.85200000000000E+13,
210 210
 																							'Pica'	=> 5.24976377952723E+06
211 211
 																						),
212
-																		'in'	=> array(	'm'		=> 2.54000000000000E-02,
212
+																		'in'	=> array('m'		=> 2.54000000000000E-02,
213 213
 																							'mi'	=> 1.57828282828283E-05,
214 214
 																							'Nmi'	=> 1.37149028077754E-05,
215 215
 																							'in'	=> 1.0,
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 																							'ang'	=> 2.54000000000000E+08,
219 219
 																							'Pica'	=> 7.19999999999955E+01
220 220
 																						),
221
-																		'ft'	=> array(	'm'		=> 3.04800000000000E-01,
221
+																		'ft'	=> array('m'		=> 3.04800000000000E-01,
222 222
 																							'mi'	=> 1.89393939393939E-04,
223 223
 																							'Nmi'	=> 1.64578833693305E-04,
224 224
 																							'in'	=> 1.20000000000000E+01,
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 																							'ang'	=> 3.04800000000000E+09,
228 228
 																							'Pica'	=> 8.63999999999946E+02
229 229
 																						),
230
-																		'yd'	=> array(	'm'		=> 9.14400000300000E-01,
230
+																		'yd'	=> array('m'		=> 9.14400000300000E-01,
231 231
 																							'mi'	=> 5.68181818368230E-04,
232 232
 																							'Nmi'	=> 4.93736501241901E-04,
233 233
 																							'in'	=> 3.60000000118110E+01,
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 																							'ang'	=> 9.14400000300000E+09,
237 237
 																							'Pica'	=> 2.59200000085023E+03
238 238
 																						),
239
-																		'ang'	=> array(	'm'		=> 1.00000000000000E-10,
239
+																		'ang'	=> array('m'		=> 1.00000000000000E-10,
240 240
 																							'mi'	=> 6.21371192237334E-14,
241 241
 																							'Nmi'	=> 5.39956803455724E-14,
242 242
 																							'in'	=> 3.93700787401575E-09,
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 																							'ang'	=> 1.0,
246 246
 																							'Pica'	=> 2.83464566929116E-07
247 247
 																						),
248
-																		'Pica'	=> array(	'm'		=> 3.52777777777800E-04,
248
+																		'Pica'	=> array('m'		=> 3.52777777777800E-04,
249 249
 																							'mi'	=> 2.19205948372629E-07,
250 250
 																							'Nmi'	=> 1.90484761219114E-07,
251 251
 																							'in'	=> 1.38888888888898E-02,
@@ -255,90 +255,90 @@  discard block
 block discarded – undo
255 255
 																							'Pica'	=> 1.0
256 256
 																						)
257 257
 																	),
258
-												'Time'		=> array(	'yr'	=> array(	'yr'		=> 1.0,
258
+												'Time'		=> array('yr'	=> array('yr'		=> 1.0,
259 259
 																							'day'		=> 365.25,
260 260
 																							'hr'		=> 8766.0,
261 261
 																							'mn'		=> 525960.0,
262 262
 																							'sec'		=> 31557600.0
263 263
 																						),
264
-																		'day'	=> array(	'yr'		=> 2.73785078713210E-03,
264
+																		'day'	=> array('yr'		=> 2.73785078713210E-03,
265 265
 																							'day'		=> 1.0,
266 266
 																							'hr'		=> 24.0,
267 267
 																							'mn'		=> 1440.0,
268 268
 																							'sec'		=> 86400.0
269 269
 																						),
270
-																		'hr'	=> array(	'yr'		=> 1.14077116130504E-04,
270
+																		'hr'	=> array('yr'		=> 1.14077116130504E-04,
271 271
 																							'day'		=> 4.16666666666667E-02,
272 272
 																							'hr'		=> 1.0,
273 273
 																							'mn'		=> 60.0,
274 274
 																							'sec'		=> 3600.0
275 275
 																						),
276
-																		'mn'	=> array(	'yr'		=> 1.90128526884174E-06,
276
+																		'mn'	=> array('yr'		=> 1.90128526884174E-06,
277 277
 																							'day'		=> 6.94444444444444E-04,
278 278
 																							'hr'		=> 1.66666666666667E-02,
279 279
 																							'mn'		=> 1.0,
280 280
 																							'sec'		=> 60.0
281 281
 																						),
282
-																		'sec'	=> array(	'yr'		=> 3.16880878140289E-08,
282
+																		'sec'	=> array('yr'		=> 3.16880878140289E-08,
283 283
 																							'day'		=> 1.15740740740741E-05,
284 284
 																							'hr'		=> 2.77777777777778E-04,
285 285
 																							'mn'		=> 1.66666666666667E-02,
286 286
 																							'sec'		=> 1.0
287 287
 																						)
288 288
 																	),
289
-												'Pressure'	=> array(	'Pa'	=> array(	'Pa'		=> 1.0,
289
+												'Pressure'	=> array('Pa'	=> array('Pa'		=> 1.0,
290 290
 																							'p'			=> 1.0,
291 291
 																							'atm'		=> 9.86923299998193E-06,
292 292
 																							'at'		=> 9.86923299998193E-06,
293 293
 																							'mmHg'		=> 7.50061707998627E-03
294 294
 																						),
295
-																		'p'		=> array(	'Pa'		=> 1.0,
295
+																		'p'		=> array('Pa'		=> 1.0,
296 296
 																							'p'			=> 1.0,
297 297
 																							'atm'		=> 9.86923299998193E-06,
298 298
 																							'at'		=> 9.86923299998193E-06,
299 299
 																							'mmHg'		=> 7.50061707998627E-03
300 300
 																						),
301
-																		'atm'	=> array(	'Pa'		=> 1.01324996583000E+05,
301
+																		'atm'	=> array('Pa'		=> 1.01324996583000E+05,
302 302
 																							'p'			=> 1.01324996583000E+05,
303 303
 																							'atm'		=> 1.0,
304 304
 																							'at'		=> 1.0,
305 305
 																							'mmHg'		=> 760.0
306 306
 																						),
307
-																		'at'	=> array(	'Pa'		=> 1.01324996583000E+05,
307
+																		'at'	=> array('Pa'		=> 1.01324996583000E+05,
308 308
 																							'p'			=> 1.01324996583000E+05,
309 309
 																							'atm'		=> 1.0,
310 310
 																							'at'		=> 1.0,
311 311
 																							'mmHg'		=> 760.0
312 312
 																						),
313
-																		'mmHg'	=> array(	'Pa'		=> 1.33322363925000E+02,
313
+																		'mmHg'	=> array('Pa'		=> 1.33322363925000E+02,
314 314
 																							'p'			=> 1.33322363925000E+02,
315 315
 																							'atm'		=> 1.31578947368421E-03,
316 316
 																							'at'		=> 1.31578947368421E-03,
317 317
 																							'mmHg'		=> 1.0
318 318
 																						)
319 319
 																	),
320
-												'Force'		=> array(	'N'		=> array(	'N'			=> 1.0,
320
+												'Force'		=> array('N'		=> array('N'			=> 1.0,
321 321
 																							'dyn'		=> 1.0E+5,
322 322
 																							'dy'		=> 1.0E+5,
323 323
 																							'lbf'		=> 2.24808923655339E-01
324 324
 																						),
325
-																		'dyn'	=> array(	'N'			=> 1.0E-5,
325
+																		'dyn'	=> array('N'			=> 1.0E-5,
326 326
 																							'dyn'		=> 1.0,
327 327
 																							'dy'		=> 1.0,
328 328
 																							'lbf'		=> 2.24808923655339E-06
329 329
 																						),
330
-																		'dy'	=> array(	'N'			=> 1.0E-5,
330
+																		'dy'	=> array('N'			=> 1.0E-5,
331 331
 																							'dyn'		=> 1.0,
332 332
 																							'dy'		=> 1.0,
333 333
 																							'lbf'		=> 2.24808923655339E-06
334 334
 																						),
335
-																		'lbf'	=> array(	'N'			=> 4.448222,
335
+																		'lbf'	=> array('N'			=> 4.448222,
336 336
 																							'dyn'		=> 4.448222E+5,
337 337
 																							'dy'		=> 4.448222E+5,
338 338
 																							'lbf'		=> 1.0
339 339
 																						)
340 340
 																	),
341
-												'Energy'	=> array(	'J'		=> array(	'J'			=> 1.0,
341
+												'Energy'	=> array('J'		=> array('J'			=> 1.0,
342 342
 																							'e'			=> 9.99999519343231E+06,
343 343
 																							'c'			=> 2.39006249473467E-01,
344 344
 																							'cal'		=> 2.38846190642017E-01,
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 																							'BTU'		=> 9.47815067349015E-04,
353 353
 																							'btu'		=> 9.47815067349015E-04
354 354
 																						),
355
-																		'e'		=> array(	'J'			=> 1.00000048065700E-07,
355
+																		'e'		=> array('J'			=> 1.00000048065700E-07,
356 356
 																							'e'			=> 1.0,
357 357
 																							'c'			=> 2.39006364353494E-08,
358 358
 																							'cal'		=> 2.38846305445111E-08,
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 																							'BTU'		=> 9.47815522922962E-11,
367 367
 																							'btu'		=> 9.47815522922962E-11
368 368
 																						),
369
-																		'c'		=> array(	'J'			=> 4.18399101363672E+00,
369
+																		'c'		=> array('J'			=> 4.18399101363672E+00,
370 370
 																							'e'			=> 4.18398900257312E+07,
371 371
 																							'c'			=> 1.0,
372 372
 																							'cal'		=> 9.99330315287563E-01,
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 																							'BTU'		=> 3.96564972437776E-03,
381 381
 																							'btu'		=> 3.96564972437776E-03
382 382
 																						),
383
-																		'cal'	=> array(	'J'			=> 4.18679484613929E+00,
383
+																		'cal'	=> array('J'			=> 4.18679484613929E+00,
384 384
 																							'e'			=> 4.18679283372801E+07,
385 385
 																							'c'			=> 1.00067013349059E+00,
386 386
 																							'cal'		=> 1.0,
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 																							'BTU'		=> 3.96830723907002E-03,
395 395
 																							'btu'		=> 3.96830723907002E-03
396 396
 																						),
397
-																		'eV'	=> array(	'J'			=> 1.60219000146921E-19,
397
+																		'eV'	=> array('J'			=> 1.60219000146921E-19,
398 398
 																							'e'			=> 1.60218923136574E-12,
399 399
 																							'c'			=> 3.82933423195043E-20,
400 400
 																							'cal'		=> 3.82676978535648E-20,
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 																							'BTU'		=> 1.51857982414846E-22,
409 409
 																							'btu'		=> 1.51857982414846E-22
410 410
 																						),
411
-																		'ev'	=> array(	'J'			=> 1.60219000146921E-19,
411
+																		'ev'	=> array('J'			=> 1.60219000146921E-19,
412 412
 																							'e'			=> 1.60218923136574E-12,
413 413
 																							'c'			=> 3.82933423195043E-20,
414 414
 																							'cal'		=> 3.82676978535648E-20,
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 																							'BTU'		=> 1.51857982414846E-22,
423 423
 																							'btu'		=> 1.51857982414846E-22
424 424
 																						),
425
-																		'HPh'	=> array(	'J'			=> 2.68451741316170E+06,
425
+																		'HPh'	=> array('J'			=> 2.68451741316170E+06,
426 426
 																							'e'			=> 2.68451612283024E+13,
427 427
 																							'c'			=> 6.41616438565991E+05,
428 428
 																							'cal'		=> 6.41186757845835E+05,
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 																							'BTU'		=> 2.54442605275546E+03,
437 437
 																							'btu'		=> 2.54442605275546E+03
438 438
 																						),
439
-																		'hh'	=> array(	'J'			=> 2.68451741316170E+06,
439
+																		'hh'	=> array('J'			=> 2.68451741316170E+06,
440 440
 																							'e'			=> 2.68451612283024E+13,
441 441
 																							'c'			=> 6.41616438565991E+05,
442 442
 																							'cal'		=> 6.41186757845835E+05,
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 																							'BTU'		=> 2.54442605275546E+03,
451 451
 																							'btu'		=> 2.54442605275546E+03
452 452
 																						),
453
-																		'Wh'	=> array(	'J'			=> 3.59999820554720E+03,
453
+																		'Wh'	=> array('J'			=> 3.59999820554720E+03,
454 454
 																							'e'			=> 3.59999647518369E+10,
455 455
 																							'c'			=> 8.60422069219046E+02,
456 456
 																							'cal'		=> 8.59845857713046E+02,
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 																							'BTU'		=> 3.41213254164705E+00,
465 465
 																							'btu'		=> 3.41213254164705E+00
466 466
 																						),
467
-																		'wh'	=> array(	'J'			=> 3.59999820554720E+03,
467
+																		'wh'	=> array('J'			=> 3.59999820554720E+03,
468 468
 																							'e'			=> 3.59999647518369E+10,
469 469
 																							'c'			=> 8.60422069219046E+02,
470 470
 																							'cal'		=> 8.59845857713046E+02,
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 																							'BTU'		=> 3.41213254164705E+00,
479 479
 																							'btu'		=> 3.41213254164705E+00
480 480
 																						),
481
-																		'flb'	=> array(	'J'			=> 4.21400003236424E-02,
481
+																		'flb'	=> array('J'			=> 4.21400003236424E-02,
482 482
 																							'e'			=> 4.21399800687660E+05,
483 483
 																							'c'			=> 1.00717234301644E-02,
484 484
 																							'cal'		=> 1.00649785509554E-02,
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 																							'BTU'		=> 3.99409272448406E-05,
493 493
 																							'btu'		=> 3.99409272448406E-05
494 494
 																						),
495
-																		'BTU'	=> array(	'J'			=> 1.05505813786749E+03,
495
+																		'BTU'	=> array('J'			=> 1.05505813786749E+03,
496 496
 																							'e'			=> 1.05505763074665E+10,
497 497
 																							'c'			=> 2.52165488508168E+02,
498 498
 																							'cal'		=> 2.51996617135510E+02,
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 																							'BTU'		=> 1.0,
507 507
 																							'btu'		=> 1.0,
508 508
 																						),
509
-																		'btu'	=> array(	'J'			=> 1.05505813786749E+03,
509
+																		'btu'	=> array('J'			=> 1.05505813786749E+03,
510 510
 																							'e'			=> 1.05505763074665E+10,
511 511
 																							'c'			=> 2.52165488508168E+02,
512 512
 																							'cal'		=> 2.51996617135510E+02,
@@ -521,35 +521,35 @@  discard block
 block discarded – undo
521 521
 																							'btu'		=> 1.0,
522 522
 																						)
523 523
 																	),
524
-												'Power'		=> array(	'HP'	=> array(	'HP'		=> 1.0,
524
+												'Power'		=> array('HP'	=> array('HP'		=> 1.0,
525 525
 																							'h'			=> 1.0,
526 526
 																							'W'			=> 7.45701000000000E+02,
527 527
 																							'w'			=> 7.45701000000000E+02
528 528
 																						),
529
-																		'h'		=> array(	'HP'		=> 1.0,
529
+																		'h'		=> array('HP'		=> 1.0,
530 530
 																							'h'			=> 1.0,
531 531
 																							'W'			=> 7.45701000000000E+02,
532 532
 																							'w'			=> 7.45701000000000E+02
533 533
 																						),
534
-																		'W'		=> array(	'HP'		=> 1.34102006031908E-03,
534
+																		'W'		=> array('HP'		=> 1.34102006031908E-03,
535 535
 																							'h'			=> 1.34102006031908E-03,
536 536
 																							'W'			=> 1.0,
537 537
 																							'w'			=> 1.0
538 538
 																						),
539
-																		'w'		=> array(	'HP'		=> 1.34102006031908E-03,
539
+																		'w'		=> array('HP'		=> 1.34102006031908E-03,
540 540
 																							'h'			=> 1.34102006031908E-03,
541 541
 																							'W'			=> 1.0,
542 542
 																							'w'			=> 1.0
543 543
 																						)
544 544
 																	),
545
-												'Magnetism'	=> array(	'T'		=> array(	'T'			=> 1.0,
545
+												'Magnetism'	=> array('T'		=> array('T'			=> 1.0,
546 546
 																							'ga'		=> 10000.0
547 547
 																						),
548
-																		'ga'	=> array(	'T'			=> 0.0001,
548
+																		'ga'	=> array('T'			=> 0.0001,
549 549
 																							'ga'		=> 1.0
550 550
 																						)
551 551
 																	),
552
-												'Liquid'	=> array(	'tsp'	=> array(	'tsp'		=> 1.0,
552
+												'Liquid'	=> array('tsp'	=> array('tsp'		=> 1.0,
553 553
 																							'tbs'		=> 3.33333333333333E-01,
554 554
 																							'oz'		=> 1.66666666666667E-01,
555 555
 																							'cup'		=> 2.08333333333333E-02,
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 																							'l'			=> 4.92999408400710E-03,
562 562
 																							'lt'		=> 4.92999408400710E-03
563 563
 																						),
564
-																		'tbs'	=> array(	'tsp'		=> 3.00000000000000E+00,
564
+																		'tbs'	=> array('tsp'		=> 3.00000000000000E+00,
565 565
 																							'tbs'		=> 1.0,
566 566
 																							'oz'		=> 5.00000000000000E-01,
567 567
 																							'cup'		=> 6.25000000000000E-02,
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 																							'l'			=> 1.47899822520213E-02,
574 574
 																							'lt'		=> 1.47899822520213E-02
575 575
 																						),
576
-																		'oz'	=> array(	'tsp'		=> 6.00000000000000E+00,
576
+																		'oz'	=> array('tsp'		=> 6.00000000000000E+00,
577 577
 																							'tbs'		=> 2.00000000000000E+00,
578 578
 																							'oz'		=> 1.0,
579 579
 																							'cup'		=> 1.25000000000000E-01,
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 																							'l'			=> 2.95799645040426E-02,
586 586
 																							'lt'		=> 2.95799645040426E-02
587 587
 																						),
588
-																		'cup'	=> array(	'tsp'		=> 4.80000000000000E+01,
588
+																		'cup'	=> array('tsp'		=> 4.80000000000000E+01,
589 589
 																							'tbs'		=> 1.60000000000000E+01,
590 590
 																							'oz'		=> 8.00000000000000E+00,
591 591
 																							'cup'		=> 1.0,
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 																							'l'			=> 2.36639716032341E-01,
598 598
 																							'lt'		=> 2.36639716032341E-01
599 599
 																						),
600
-																		'pt'	=> array(	'tsp'		=> 9.60000000000000E+01,
600
+																		'pt'	=> array('tsp'		=> 9.60000000000000E+01,
601 601
 																							'tbs'		=> 3.20000000000000E+01,
602 602
 																							'oz'		=> 1.60000000000000E+01,
603 603
 																							'cup'		=> 2.00000000000000E+00,
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 																							'l'			=> 4.73279432064682E-01,
610 610
 																							'lt'		=> 4.73279432064682E-01
611 611
 																						),
612
-																		'us_pt'	=> array(	'tsp'		=> 9.60000000000000E+01,
612
+																		'us_pt'	=> array('tsp'		=> 9.60000000000000E+01,
613 613
 																							'tbs'		=> 3.20000000000000E+01,
614 614
 																							'oz'		=> 1.60000000000000E+01,
615 615
 																							'cup'		=> 2.00000000000000E+00,
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 																							'l'			=> 4.73279432064682E-01,
622 622
 																							'lt'		=> 4.73279432064682E-01
623 623
 																						),
624
-																		'uk_pt'	=> array(	'tsp'		=> 1.15266000000000E+02,
624
+																		'uk_pt'	=> array('tsp'		=> 1.15266000000000E+02,
625 625
 																							'tbs'		=> 3.84220000000000E+01,
626 626
 																							'oz'		=> 1.92110000000000E+01,
627 627
 																							'cup'		=> 2.40137500000000E+00,
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 																							'l'			=> 5.68260698087162E-01,
634 634
 																							'lt'		=> 5.68260698087162E-01
635 635
 																						),
636
-																		'qt'	=> array(	'tsp'		=> 1.92000000000000E+02,
636
+																		'qt'	=> array('tsp'		=> 1.92000000000000E+02,
637 637
 																							'tbs'		=> 6.40000000000000E+01,
638 638
 																							'oz'		=> 3.20000000000000E+01,
639 639
 																							'cup'		=> 4.00000000000000E+00,
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 																							'l'			=> 9.46558864129363E-01,
646 646
 																							'lt'		=> 9.46558864129363E-01
647 647
 																						),
648
-																		'gal'	=> array(	'tsp'		=> 7.68000000000000E+02,
648
+																		'gal'	=> array('tsp'		=> 7.68000000000000E+02,
649 649
 																							'tbs'		=> 2.56000000000000E+02,
650 650
 																							'oz'		=> 1.28000000000000E+02,
651 651
 																							'cup'		=> 1.60000000000000E+01,
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 																							'l'			=> 3.78623545651745E+00,
658 658
 																							'lt'		=> 3.78623545651745E+00
659 659
 																						),
660
-																		'l'		=> array(	'tsp'		=> 2.02840000000000E+02,
660
+																		'l'		=> array('tsp'		=> 2.02840000000000E+02,
661 661
 																							'tbs'		=> 6.76133333333333E+01,
662 662
 																							'oz'		=> 3.38066666666667E+01,
663 663
 																							'cup'		=> 4.22583333333333E+00,
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 																							'l'			=> 1.0,
670 670
 																							'lt'		=> 1.0
671 671
 																						),
672
-																		'lt'	=> array(	'tsp'		=> 2.02840000000000E+02,
672
+																		'lt'	=> array('tsp'		=> 2.02840000000000E+02,
673 673
 																							'tbs'		=> 6.76133333333333E+01,
674 674
 																							'oz'		=> 3.38066666666667E+01,
675 675
 																							'cup'		=> 4.22583333333333E+00,
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
 
699 699
 		$realNumber = $imaginary = 0;
700 700
 		//	Extract the suffix, if there is one
701
-		$suffix = substr($workString,-1);
702
-		if (!is_numeric($suffix)) {
703
-			$workString = substr($workString,0,-1);
701
+		$suffix = substr($workString, -1);
702
+		if ( ! is_numeric($suffix)) {
703
+			$workString = substr($workString, 0, -1);
704 704
 		} else {
705 705
 			$suffix = '';
706 706
 		}
@@ -712,15 +712,15 @@  discard block
 block discarded – undo
712 712
 		}
713 713
 		$power = '';
714 714
 		$realNumber = strtok($workString, '+-');
715
-		if (strtoupper(substr($realNumber,-1)) == 'E') {
715
+		if (strtoupper(substr($realNumber, -1)) == 'E') {
716 716
 			$power = strtok('+-');
717 717
 			++$leadingSign;
718 718
 		}
719 719
 
720
-		$realNumber = substr($workString,0,strlen($realNumber)+strlen($power)+$leadingSign);
720
+		$realNumber = substr($workString, 0, strlen($realNumber) + strlen($power) + $leadingSign);
721 721
 
722 722
 		if ($suffix != '') {
723
-			$imaginary = substr($workString,strlen($realNumber));
723
+			$imaginary = substr($workString, strlen($realNumber));
724 724
 
725 725
 			if (($imaginary == '') && (($realNumber == '') || ($realNumber == '+') || ($realNumber == '-'))) {
726 726
 				$imaginary = $realNumber.'1';
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 			}
734 734
 		}
735 735
 
736
-		return array( 'real'		=> $realNumber,
736
+		return array('real'		=> $realNumber,
737 737
 					  'imaginary'	=> $imaginary,
738 738
 					  'suffix'		=> $suffix
739 739
 					);
@@ -749,24 +749,24 @@  discard block
 block discarded – undo
749 749
 	 * @return	string		The "cleaned" complex number
750 750
 	 */
751 751
 	private static function _cleanComplex($complexNumber) {
752
-		if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber,1);
753
-		if ($complexNumber{0} == '0') $complexNumber = substr($complexNumber,1);
752
+		if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber, 1);
753
+		if ($complexNumber{0} == '0') $complexNumber = substr($complexNumber, 1);
754 754
 		if ($complexNumber{0} == '.') $complexNumber = '0'.$complexNumber;
755
-		if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber,1);
755
+		if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber, 1);
756 756
 		return $complexNumber;
757 757
 	}
758 758
 
759 759
 
760
-	private static function _nbrConversionFormat($xVal,$places) {
761
-		if (!is_null($places)) {
760
+	private static function _nbrConversionFormat($xVal, $places) {
761
+		if ( ! is_null($places)) {
762 762
 			if (strlen($xVal) <= $places) {
763
-				return substr(str_pad($xVal,$places,'0',STR_PAD_LEFT),-10);
763
+				return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10);
764 764
 			} else {
765 765
 				return PHPExcel_Calculation_Functions::NaN();
766 766
 			}
767 767
 		}
768 768
 
769
-		return substr($xVal,-10);
769
+		return substr($xVal, -10);
770 770
 	}	//	function _nbrConversionFormat()
771 771
 
772 772
 
@@ -792,11 +792,11 @@  discard block
 block discarded – undo
792 792
 	 *
793 793
 	 */
794 794
 	public static function BESSELI($x, $ord) {
795
-		$x	= (is_null($x))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($x);
796
-		$ord	= (is_null($ord))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($ord);
795
+		$x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x);
796
+		$ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
797 797
 
798 798
 		if ((is_numeric($x)) && (is_numeric($ord))) {
799
-			$ord	= floor($ord);
799
+			$ord = floor($ord);
800 800
 			if ($ord < 0) {
801 801
 				return PHPExcel_Calculation_Functions::NaN();
802 802
 			}
@@ -846,11 +846,11 @@  discard block
 block discarded – undo
846 846
 	 *
847 847
 	 */
848 848
 	public static function BESSELJ($x, $ord) {
849
-		$x	= (is_null($x))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($x);
850
-		$ord	= (is_null($ord))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($ord);
849
+		$x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x);
850
+		$ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
851 851
 
852 852
 		if ((is_numeric($x)) && (is_numeric($ord))) {
853
-			$ord	= floor($ord);
853
+			$ord = floor($ord);
854 854
 			if ($ord < 0) {
855 855
 				return PHPExcel_Calculation_Functions::NaN();
856 856
 			}
@@ -937,26 +937,26 @@  discard block
 block discarded – undo
937 937
 	 *
938 938
 	 */
939 939
 	public static function BESSELK($x, $ord) {
940
-		$x		= (is_null($x))		? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($x);
941
-		$ord	= (is_null($ord))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($ord);
940
+		$x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x);
941
+		$ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
942 942
 
943 943
 		if ((is_numeric($x)) && (is_numeric($ord))) {
944 944
 			if (($ord < 0) || ($x == 0.0)) {
945 945
 				return PHPExcel_Calculation_Functions::NaN();
946 946
 			}
947 947
 
948
-			switch(floor($ord)) {
948
+			switch (floor($ord)) {
949 949
 				case 0 :	return self::_Besselk0($x);
950 950
 							break;
951 951
 				case 1 :	return self::_Besselk1($x);
952 952
 							break;
953
-				default :	$fTox	= 2 / $x;
954
-							$fBkm	= self::_Besselk0($x);
955
-							$fBk	= self::_Besselk1($x);
953
+				default :	$fTox = 2 / $x;
954
+							$fBkm = self::_Besselk0($x);
955
+							$fBk = self::_Besselk1($x);
956 956
 							for ($n = 1; $n < $ord; ++$n) {
957 957
 								$fBkp	= $fBkm + $n * $fTox * $fBk;
958 958
 								$fBkm	= $fBk;
959
-								$fBk	= $fBkp;
959
+								$fBk = $fBkp;
960 960
 							}
961 961
 			}
962 962
 			return (is_nan($fBk)) ? PHPExcel_Calculation_Functions::NaN() : $fBk;
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 				(-0.4237922726e7 + $y * 0.8511937935e4)))));
991 991
 			$f2 = 0.2499580570e14 + $y * (0.4244419664e12 + $y * (0.3733650367e10 + $y * (0.2245904002e8 + $y *
992 992
 				(0.1020426050e6 + $y * (0.3549632885e3 + $y)))));
993
-			$fRet = $f1 / $f2 + 0.636619772 * ( self::BESSELJ($fNum, 1) * log($fNum) - 1 / $fNum);
993
+			$fRet = $f1 / $f2 + 0.636619772 * (self::BESSELJ($fNum, 1) * log($fNum) - 1 / $fNum);
994 994
 		} else {
995 995
 //			$z = 8.0 / $fNum;
996 996
 //			$y = ($z * $z);
@@ -1026,26 +1026,26 @@  discard block
 block discarded – undo
1026 1026
 	 * @return	float
1027 1027
 	 */
1028 1028
 	public static function BESSELY($x, $ord) {
1029
-		$x		= (is_null($x))		? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($x);
1030
-		$ord	= (is_null($ord))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($ord);
1029
+		$x = (is_null($x)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x);
1030
+		$ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
1031 1031
 
1032 1032
 		if ((is_numeric($x)) && (is_numeric($ord))) {
1033 1033
 			if (($ord < 0) || ($x == 0.0)) {
1034 1034
 				return PHPExcel_Calculation_Functions::NaN();
1035 1035
 			}
1036 1036
 
1037
-			switch(floor($ord)) {
1037
+			switch (floor($ord)) {
1038 1038
 				case 0 :	return self::_Bessely0($x);
1039 1039
 							break;
1040 1040
 				case 1 :	return self::_Bessely1($x);
1041 1041
 							break;
1042
-				default:	$fTox	= 2 / $x;
1043
-							$fBym	= self::_Bessely0($x);
1044
-							$fBy	= self::_Bessely1($x);
1042
+				default:	$fTox = 2 / $x;
1043
+							$fBym = self::_Bessely0($x);
1044
+							$fBy = self::_Bessely1($x);
1045 1045
 							for ($n = 1; $n < $ord; ++$n) {
1046 1046
 								$fByp	= $n * $fTox * $fBy - $fBym;
1047 1047
 								$fBym	= $fBy;
1048
-								$fBy	= $fByp;
1048
+								$fBy = $fByp;
1049 1049
 							}
1050 1050
 			}
1051 1051
 			return (is_nan($fBy)) ? PHPExcel_Calculation_Functions::NaN() : $fBy;
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 	 * @return	string
1074 1074
 	 */
1075 1075
 	public static function BINTODEC($x) {
1076
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1076
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1077 1077
 
1078 1078
 		if (is_bool($x)) {
1079 1079
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
@@ -1086,15 +1086,15 @@  discard block
 block discarded – undo
1086 1086
 			$x = floor($x);
1087 1087
 		}
1088 1088
 		$x = (string) $x;
1089
-		if (strlen($x) > preg_match_all('/[01]/',$x,$out)) {
1089
+		if (strlen($x) > preg_match_all('/[01]/', $x, $out)) {
1090 1090
 			return PHPExcel_Calculation_Functions::NaN();
1091 1091
 		}
1092 1092
 		if (strlen($x) > 10) {
1093 1093
 			return PHPExcel_Calculation_Functions::NaN();
1094 1094
 		} elseif (strlen($x) == 10) {
1095 1095
 			//	Two's Complement
1096
-			$x = substr($x,-9);
1097
-			return '-'.(512-bindec($x));
1096
+			$x = substr($x, -9);
1097
+			return '-'.(512 - bindec($x));
1098 1098
 		}
1099 1099
 		return bindec($x);
1100 1100
 	}	//	function BINTODEC()
@@ -1124,9 +1124,9 @@  discard block
 block discarded – undo
1124 1124
 	 *								If places is negative, BIN2HEX returns the #NUM! error value.
1125 1125
 	 * @return	string
1126 1126
 	 */
1127
-	public static function BINTOHEX($x, $places=NULL) {
1128
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1129
-		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
1127
+	public static function BINTOHEX($x, $places = NULL) {
1128
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1129
+		$places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
1130 1130
 
1131 1131
 		if (is_bool($x)) {
1132 1132
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
@@ -1139,18 +1139,18 @@  discard block
 block discarded – undo
1139 1139
 			$x = floor($x);
1140 1140
 		}
1141 1141
 		$x = (string) $x;
1142
-		if (strlen($x) > preg_match_all('/[01]/',$x,$out)) {
1142
+		if (strlen($x) > preg_match_all('/[01]/', $x, $out)) {
1143 1143
 			return PHPExcel_Calculation_Functions::NaN();
1144 1144
 		}
1145 1145
 		if (strlen($x) > 10) {
1146 1146
 			return PHPExcel_Calculation_Functions::NaN();
1147 1147
 		} elseif (strlen($x) == 10) {
1148 1148
 			//	Two's Complement
1149
-			return str_repeat('F',8).substr(strtoupper(dechex(bindec(substr($x,-9)))),-2);
1149
+			return str_repeat('F', 8).substr(strtoupper(dechex(bindec(substr($x, -9)))), -2);
1150 1150
 		}
1151 1151
 		$hexVal = (string) strtoupper(dechex(bindec($x)));
1152 1152
 
1153
-		return self::_nbrConversionFormat($hexVal,$places);
1153
+		return self::_nbrConversionFormat($hexVal, $places);
1154 1154
 	}	//	function BINTOHEX()
1155 1155
 
1156 1156
 
@@ -1178,9 +1178,9 @@  discard block
 block discarded – undo
1178 1178
 	 *								If places is negative, BIN2OCT returns the #NUM! error value.
1179 1179
 	 * @return	string
1180 1180
 	 */
1181
-	public static function BINTOOCT($x, $places=NULL) {
1182
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1183
-		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
1181
+	public static function BINTOOCT($x, $places = NULL) {
1182
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1183
+		$places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
1184 1184
 
1185 1185
 		if (is_bool($x)) {
1186 1186
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
@@ -1193,18 +1193,18 @@  discard block
 block discarded – undo
1193 1193
 			$x = floor($x);
1194 1194
 		}
1195 1195
 		$x = (string) $x;
1196
-		if (strlen($x) > preg_match_all('/[01]/',$x,$out)) {
1196
+		if (strlen($x) > preg_match_all('/[01]/', $x, $out)) {
1197 1197
 			return PHPExcel_Calculation_Functions::NaN();
1198 1198
 		}
1199 1199
 		if (strlen($x) > 10) {
1200 1200
 			return PHPExcel_Calculation_Functions::NaN();
1201 1201
 		} elseif (strlen($x) == 10) {
1202 1202
 			//	Two's Complement
1203
-			return str_repeat('7',7).substr(strtoupper(decoct(bindec(substr($x,-9)))),-3);
1203
+			return str_repeat('7', 7).substr(strtoupper(decoct(bindec(substr($x, -9)))), -3);
1204 1204
 		}
1205 1205
 		$octVal = (string) decoct(bindec($x));
1206 1206
 
1207
-		return self::_nbrConversionFormat($octVal,$places);
1207
+		return self::_nbrConversionFormat($octVal, $places);
1208 1208
 	}	//	function BINTOOCT()
1209 1209
 
1210 1210
 
@@ -1236,9 +1236,9 @@  discard block
 block discarded – undo
1236 1236
 	 *								If places is zero or negative, DEC2BIN returns the #NUM! error value.
1237 1237
 	 * @return	string
1238 1238
 	 */
1239
-	public static function DECTOBIN($x, $places=NULL) {
1240
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1241
-		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
1239
+	public static function DECTOBIN($x, $places = NULL) {
1240
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1241
+		$places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
1242 1242
 
1243 1243
 		if (is_bool($x)) {
1244 1244
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
@@ -1248,19 +1248,19 @@  discard block
 block discarded – undo
1248 1248
 			}
1249 1249
 		}
1250 1250
 		$x = (string) $x;
1251
-		if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) {
1251
+		if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) {
1252 1252
 			return PHPExcel_Calculation_Functions::VALUE();
1253 1253
 		}
1254 1254
 		$x = (string) floor($x);
1255 1255
 		$r = decbin($x);
1256 1256
 		if (strlen($r) == 32) {
1257 1257
 			//	Two's Complement
1258
-			$r = substr($r,-10);
1258
+			$r = substr($r, -10);
1259 1259
 		} elseif (strlen($r) > 11) {
1260 1260
 			return PHPExcel_Calculation_Functions::NaN();
1261 1261
 		}
1262 1262
 
1263
-		return self::_nbrConversionFormat($r,$places);
1263
+		return self::_nbrConversionFormat($r, $places);
1264 1264
 	}	//	function DECTOBIN()
1265 1265
 
1266 1266
 
@@ -1292,9 +1292,9 @@  discard block
 block discarded – undo
1292 1292
 	 *								If places is zero or negative, DEC2HEX returns the #NUM! error value.
1293 1293
 	 * @return	string
1294 1294
 	 */
1295
-	public static function DECTOHEX($x, $places=null) {
1296
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1297
-		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
1295
+	public static function DECTOHEX($x, $places = null) {
1296
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1297
+		$places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
1298 1298
 
1299 1299
 		if (is_bool($x)) {
1300 1300
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 			}
1305 1305
 		}
1306 1306
 		$x = (string) $x;
1307
-		if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) {
1307
+		if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) {
1308 1308
 			return PHPExcel_Calculation_Functions::VALUE();
1309 1309
 		}
1310 1310
 		$x = (string) floor($x);
@@ -1314,7 +1314,7 @@  discard block
 block discarded – undo
1314 1314
 			$r = 'FF'.$r;
1315 1315
 		}
1316 1316
 
1317
-		return self::_nbrConversionFormat($r,$places);
1317
+		return self::_nbrConversionFormat($r, $places);
1318 1318
 	}	//	function DECTOHEX()
1319 1319
 
1320 1320
 
@@ -1346,9 +1346,9 @@  discard block
 block discarded – undo
1346 1346
 	 *								If places is zero or negative, DEC2OCT returns the #NUM! error value.
1347 1347
 	 * @return	string
1348 1348
 	 */
1349
-	public static function DECTOOCT($x, $places=null) {
1350
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1351
-		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
1349
+	public static function DECTOOCT($x, $places = null) {
1350
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1351
+		$places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
1352 1352
 
1353 1353
 		if (is_bool($x)) {
1354 1354
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
@@ -1358,17 +1358,17 @@  discard block
 block discarded – undo
1358 1358
 			}
1359 1359
 		}
1360 1360
 		$x = (string) $x;
1361
-		if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) {
1361
+		if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) {
1362 1362
 			return PHPExcel_Calculation_Functions::VALUE();
1363 1363
 		}
1364 1364
 		$x = (string) floor($x);
1365 1365
 		$r = decoct($x);
1366 1366
 		if (strlen($r) == 11) {
1367 1367
 			//	Two's Complement
1368
-			$r = substr($r,-10);
1368
+			$r = substr($r, -10);
1369 1369
 		}
1370 1370
 
1371
-		return self::_nbrConversionFormat($r,$places);
1371
+		return self::_nbrConversionFormat($r, $places);
1372 1372
 	}	//	function DECTOOCT()
1373 1373
 
1374 1374
 
@@ -1403,20 +1403,20 @@  discard block
 block discarded – undo
1403 1403
 	 *									If places is negative, HEX2BIN returns the #NUM! error value.
1404 1404
 	 * @return	string
1405 1405
 	 */
1406
-	public static function HEXTOBIN($x, $places=null) {
1407
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1408
-		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
1406
+	public static function HEXTOBIN($x, $places = null) {
1407
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1408
+		$places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
1409 1409
 
1410 1410
 		if (is_bool($x)) {
1411 1411
 			return PHPExcel_Calculation_Functions::VALUE();
1412 1412
 		}
1413 1413
 		$x = (string) $x;
1414
-		if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) {
1414
+		if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
1415 1415
 			return PHPExcel_Calculation_Functions::NaN();
1416 1416
 		}
1417 1417
 		$binVal = decbin(hexdec($x));
1418 1418
 
1419
-		return substr(self::_nbrConversionFormat($binVal,$places),-10);
1419
+		return substr(self::_nbrConversionFormat($binVal, $places), -10);
1420 1420
 	}	//	function HEXTOBIN()
1421 1421
 
1422 1422
 
@@ -1440,13 +1440,13 @@  discard block
 block discarded – undo
1440 1440
 	 * @return	string
1441 1441
 	 */
1442 1442
 	public static function HEXTODEC($x) {
1443
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1443
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1444 1444
 
1445 1445
 		if (is_bool($x)) {
1446 1446
 			return PHPExcel_Calculation_Functions::VALUE();
1447 1447
 		}
1448 1448
 		$x = (string) $x;
1449
-		if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) {
1449
+		if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
1450 1450
 			return PHPExcel_Calculation_Functions::NaN();
1451 1451
 		}
1452 1452
 		return hexdec($x);
@@ -1485,20 +1485,20 @@  discard block
 block discarded – undo
1485 1485
 	 *									If places is negative, HEX2OCT returns the #NUM! error value.
1486 1486
 	 * @return	string
1487 1487
 	 */
1488
-	public static function HEXTOOCT($x, $places=null) {
1489
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1490
-		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
1488
+	public static function HEXTOOCT($x, $places = null) {
1489
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1490
+		$places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
1491 1491
 
1492 1492
 		if (is_bool($x)) {
1493 1493
 			return PHPExcel_Calculation_Functions::VALUE();
1494 1494
 		}
1495 1495
 		$x = (string) $x;
1496
-		if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) {
1496
+		if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) {
1497 1497
 			return PHPExcel_Calculation_Functions::NaN();
1498 1498
 		}
1499 1499
 		$octVal = decoct(hexdec($x));
1500 1500
 
1501
-		return self::_nbrConversionFormat($octVal,$places);
1501
+		return self::_nbrConversionFormat($octVal, $places);
1502 1502
 	}	//	function HEXTOOCT()
1503 1503
 
1504 1504
 
@@ -1536,20 +1536,20 @@  discard block
 block discarded – undo
1536 1536
 	 *									value.
1537 1537
 	 * @return	string
1538 1538
 	 */
1539
-	public static function OCTTOBIN($x, $places=null) {
1540
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1541
-		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
1539
+	public static function OCTTOBIN($x, $places = null) {
1540
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1541
+		$places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
1542 1542
 
1543 1543
 		if (is_bool($x)) {
1544 1544
 			return PHPExcel_Calculation_Functions::VALUE();
1545 1545
 		}
1546 1546
 		$x = (string) $x;
1547
-		if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) {
1547
+		if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
1548 1548
 			return PHPExcel_Calculation_Functions::NaN();
1549 1549
 		}
1550 1550
 		$r = decbin(octdec($x));
1551 1551
 
1552
-		return self::_nbrConversionFormat($r,$places);
1552
+		return self::_nbrConversionFormat($r, $places);
1553 1553
 	}	//	function OCTTOBIN()
1554 1554
 
1555 1555
 
@@ -1573,13 +1573,13 @@  discard block
 block discarded – undo
1573 1573
 	 * @return	string
1574 1574
 	 */
1575 1575
 	public static function OCTTODEC($x) {
1576
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1576
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1577 1577
 
1578 1578
 		if (is_bool($x)) {
1579 1579
 			return PHPExcel_Calculation_Functions::VALUE();
1580 1580
 		}
1581 1581
 		$x = (string) $x;
1582
-		if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) {
1582
+		if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
1583 1583
 			return PHPExcel_Calculation_Functions::NaN();
1584 1584
 		}
1585 1585
 		return octdec($x);
@@ -1615,20 +1615,20 @@  discard block
 block discarded – undo
1615 1615
 	 *									If places is negative, OCT2HEX returns the #NUM! error value.
1616 1616
 	 * @return	string
1617 1617
 	 */
1618
-	public static function OCTTOHEX($x, $places=null) {
1619
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
1620
-		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
1618
+	public static function OCTTOHEX($x, $places = null) {
1619
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
1620
+		$places = PHPExcel_Calculation_Functions::flattenSingleValue($places);
1621 1621
 
1622 1622
 		if (is_bool($x)) {
1623 1623
 			return PHPExcel_Calculation_Functions::VALUE();
1624 1624
 		}
1625 1625
 		$x = (string) $x;
1626
-		if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) {
1626
+		if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
1627 1627
 			return PHPExcel_Calculation_Functions::NaN();
1628 1628
 		}
1629 1629
 		$hexVal = strtoupper(dechex(octdec($x)));
1630 1630
 
1631
-		return self::_nbrConversionFormat($hexVal,$places);
1631
+		return self::_nbrConversionFormat($hexVal, $places);
1632 1632
 	}	//	function OCTTOHEX()
1633 1633
 
1634 1634
 
@@ -1648,15 +1648,15 @@  discard block
 block discarded – undo
1648 1648
 	 *										If omitted, the suffix is assumed to be "i".
1649 1649
 	 * @return	string
1650 1650
 	 */
1651
-	public static function COMPLEX($realNumber=0.0, $imaginary=0.0, $suffix='i') {
1652
-		$realNumber	= (is_null($realNumber))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
1653
-		$imaginary	= (is_null($imaginary))		? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($imaginary);
1654
-		$suffix		= (is_null($suffix))		? 'i' :	PHPExcel_Calculation_Functions::flattenSingleValue($suffix);
1651
+	public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i') {
1652
+		$realNumber = (is_null($realNumber)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
1653
+		$imaginary = (is_null($imaginary)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($imaginary);
1654
+		$suffix = (is_null($suffix)) ? 'i' : PHPExcel_Calculation_Functions::flattenSingleValue($suffix);
1655 1655
 
1656 1656
 		if (((is_numeric($realNumber)) && (is_numeric($imaginary))) &&
1657 1657
 			(($suffix == 'i') || ($suffix == 'j') || ($suffix == ''))) {
1658
-			$realNumber	= (float) $realNumber;
1659
-			$imaginary	= (float) $imaginary;
1658
+			$realNumber = (float) $realNumber;
1659
+			$imaginary = (float) $imaginary;
1660 1660
 
1661 1661
 			if ($suffix == '') $suffix = 'i';
1662 1662
 			if ($realNumber == 0.0) {
@@ -1766,7 +1766,7 @@  discard block
 block discarded – undo
1766 1766
 		if ($parsedComplex['real'] == 0.0) {
1767 1767
 			if ($parsedComplex['imaginary'] == 0.0) {
1768 1768
 				return 0.0;
1769
-			} elseif($parsedComplex['imaginary'] < 0.0) {
1769
+			} elseif ($parsedComplex['imaginary'] < 0.0) {
1770 1770
 				return M_PI / -2;
1771 1771
 			} else {
1772 1772
 				return M_PI / 2;
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 		if ($parsedComplex['imaginary'] == 0.0) {
1801 1801
 			return $parsedComplex['real'];
1802 1802
 		} else {
1803
-			return self::_cleanComplex( self::COMPLEX( $parsedComplex['real'],
1803
+			return self::_cleanComplex(self::COMPLEX($parsedComplex['real'],
1804 1804
 													   0 - $parsedComplex['imaginary'],
1805 1805
 													   $parsedComplex['suffix']
1806 1806
 													 )
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
 		if ($parsedComplex['imaginary'] == 0.0) {
1829 1829
 			return cos($parsedComplex['real']);
1830 1830
 		} else {
1831
-			return self::IMCONJUGATE(self::COMPLEX(cos($parsedComplex['real']) * cosh($parsedComplex['imaginary']),sin($parsedComplex['real']) * sinh($parsedComplex['imaginary']),$parsedComplex['suffix']));
1831
+			return self::IMCONJUGATE(self::COMPLEX(cos($parsedComplex['real']) * cosh($parsedComplex['imaginary']), sin($parsedComplex['real']) * sinh($parsedComplex['imaginary']), $parsedComplex['suffix']));
1832 1832
 		}
1833 1833
 	}	//	function IMCOS()
1834 1834
 
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 		if ($parsedComplex['imaginary'] == 0.0) {
1853 1853
 			return sin($parsedComplex['real']);
1854 1854
 		} else {
1855
-			return self::COMPLEX(sin($parsedComplex['real']) * cosh($parsedComplex['imaginary']),cos($parsedComplex['real']) * sinh($parsedComplex['imaginary']),$parsedComplex['suffix']);
1855
+			return self::COMPLEX(sin($parsedComplex['real']) * cosh($parsedComplex['imaginary']), cos($parsedComplex['real']) * sinh($parsedComplex['imaginary']), $parsedComplex['suffix']);
1856 1856
 		}
1857 1857
 	}	//	function IMSIN()
1858 1858
 
@@ -1879,9 +1879,9 @@  discard block
 block discarded – undo
1879 1879
 		$r = sqrt(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])));
1880 1880
 
1881 1881
 		if ($parsedComplex['suffix'] == '') {
1882
-			return self::COMPLEX($d1 * $r,$d2 * $r);
1882
+			return self::COMPLEX($d1 * $r, $d2 * $r);
1883 1883
 		} else {
1884
-			return self::COMPLEX($d1 * $r,$d2 * $r,$parsedComplex['suffix']);
1884
+			return self::COMPLEX($d1 * $r, $d2 * $r, $parsedComplex['suffix']);
1885 1885
 		}
1886 1886
 	}	//	function IMSQRT()
1887 1887
 
@@ -1910,9 +1910,9 @@  discard block
 block discarded – undo
1910 1910
 		$t = self::IMARGUMENT($complexNumber);
1911 1911
 
1912 1912
 		if ($parsedComplex['suffix'] == '') {
1913
-			return self::COMPLEX($logR,$t);
1913
+			return self::COMPLEX($logR, $t);
1914 1914
 		} else {
1915
-			return self::COMPLEX($logR,$t,$parsedComplex['suffix']);
1915
+			return self::COMPLEX($logR, $t, $parsedComplex['suffix']);
1916 1916
 		}
1917 1917
 	}	//	function IMLN()
1918 1918
 
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
 			return log10($parsedComplex['real']);
1940 1940
 		}
1941 1941
 
1942
-		return self::IMPRODUCT(log10(EULER),self::IMLN($complexNumber));
1942
+		return self::IMPRODUCT(log10(EULER), self::IMLN($complexNumber));
1943 1943
 	}	//	function IMLOG10()
1944 1944
 
1945 1945
 
@@ -1962,10 +1962,10 @@  discard block
 block discarded – undo
1962 1962
 		if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
1963 1963
 			return PHPExcel_Calculation_Functions::NaN();
1964 1964
 		} elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
1965
-			return log($parsedComplex['real'],2);
1965
+			return log($parsedComplex['real'], 2);
1966 1966
 		}
1967 1967
 
1968
-		return self::IMPRODUCT(log(EULER,2),self::IMLN($complexNumber));
1968
+		return self::IMPRODUCT(log(EULER, 2), self::IMLN($complexNumber));
1969 1969
 	}	//	function IMLOG2()
1970 1970
 
1971 1971
 
@@ -1994,9 +1994,9 @@  discard block
 block discarded – undo
1994 1994
 		$eY = $e * sin($parsedComplex['imaginary']);
1995 1995
 
1996 1996
 		if ($parsedComplex['suffix'] == '') {
1997
-			return self::COMPLEX($eX,$eY);
1997
+			return self::COMPLEX($eX, $eY);
1998 1998
 		} else {
1999
-			return self::COMPLEX($eX,$eY,$parsedComplex['suffix']);
1999
+			return self::COMPLEX($eX, $eY, $parsedComplex['suffix']);
2000 2000
 		}
2001 2001
 	}	//	function IMEXP()
2002 2002
 
@@ -2013,25 +2013,25 @@  discard block
 block discarded – undo
2013 2013
 	 * @param	float		$realNumber		The power to which you want to raise the complex number.
2014 2014
 	 * @return	string
2015 2015
 	 */
2016
-	public static function IMPOWER($complexNumber,$realNumber) {
2017
-		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
2018
-		$realNumber		= PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
2016
+	public static function IMPOWER($complexNumber, $realNumber) {
2017
+		$complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
2018
+		$realNumber = PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
2019 2019
 
2020
-		if (!is_numeric($realNumber)) {
2020
+		if ( ! is_numeric($realNumber)) {
2021 2021
 			return PHPExcel_Calculation_Functions::VALUE();
2022 2022
 		}
2023 2023
 
2024 2024
 		$parsedComplex = self::_parseComplex($complexNumber);
2025 2025
 
2026 2026
 		$r = sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary']));
2027
-		$rPower = pow($r,$realNumber);
2027
+		$rPower = pow($r, $realNumber);
2028 2028
 		$theta = self::IMARGUMENT($complexNumber) * $realNumber;
2029 2029
 		if ($theta == 0) {
2030 2030
 			return 1;
2031 2031
 		} elseif ($parsedComplex['imaginary'] == 0.0) {
2032
-			return self::COMPLEX($rPower * cos($theta),$rPower * sin($theta),$parsedComplex['suffix']);
2032
+			return self::COMPLEX($rPower * cos($theta), $rPower * sin($theta), $parsedComplex['suffix']);
2033 2033
 		} else {
2034
-			return self::COMPLEX($rPower * cos($theta),$rPower * sin($theta),$parsedComplex['suffix']);
2034
+			return self::COMPLEX($rPower * cos($theta), $rPower * sin($theta), $parsedComplex['suffix']);
2035 2035
 		}
2036 2036
 	}	//	function IMPOWER()
2037 2037
 
@@ -2048,9 +2048,9 @@  discard block
 block discarded – undo
2048 2048
 	 * @param	string		$complexDivisor		The complex denominator or divisor.
2049 2049
 	 * @return	string
2050 2050
 	 */
2051
-	public static function IMDIV($complexDividend,$complexDivisor) {
2052
-		$complexDividend	= PHPExcel_Calculation_Functions::flattenSingleValue($complexDividend);
2053
-		$complexDivisor	= PHPExcel_Calculation_Functions::flattenSingleValue($complexDivisor);
2051
+	public static function IMDIV($complexDividend, $complexDivisor) {
2052
+		$complexDividend = PHPExcel_Calculation_Functions::flattenSingleValue($complexDividend);
2053
+		$complexDivisor = PHPExcel_Calculation_Functions::flattenSingleValue($complexDivisor);
2054 2054
 
2055 2055
 		$parsedComplexDividend = self::_parseComplex($complexDividend);
2056 2056
 		$parsedComplexDivisor = self::_parseComplex($complexDivisor);
@@ -2067,8 +2067,8 @@  discard block
 block discarded – undo
2067 2067
 		$d2 = ($parsedComplexDividend['imaginary'] * $parsedComplexDivisor['real']) - ($parsedComplexDividend['real'] * $parsedComplexDivisor['imaginary']);
2068 2068
 		$d3 = ($parsedComplexDivisor['real'] * $parsedComplexDivisor['real']) + ($parsedComplexDivisor['imaginary'] * $parsedComplexDivisor['imaginary']);
2069 2069
 
2070
-		$r = $d1/$d3;
2071
-		$i = $d2/$d3;
2070
+		$r = $d1 / $d3;
2071
+		$i = $d2 / $d3;
2072 2072
 
2073 2073
 		if ($i > 0.0) {
2074 2074
 			return self::_cleanComplex($r.'+'.$i.$parsedComplexDivisor['suffix']);
@@ -2092,7 +2092,7 @@  discard block
 block discarded – undo
2092 2092
 	 * @param	string		$complexNumber2		The complex number to subtract from complexNumber1.
2093 2093
 	 * @return	string
2094 2094
 	 */
2095
-	public static function IMSUB($complexNumber1,$complexNumber2) {
2095
+	public static function IMSUB($complexNumber1, $complexNumber2) {
2096 2096
 		$complexNumber1	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber1);
2097 2097
 		$complexNumber2	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber2);
2098 2098
 
@@ -2109,7 +2109,7 @@  discard block
 block discarded – undo
2109 2109
 		$d1 = $parsedComplex1['real'] - $parsedComplex2['real'];
2110 2110
 		$d2 = $parsedComplex1['imaginary'] - $parsedComplex2['imaginary'];
2111 2111
 
2112
-		return self::COMPLEX($d1,$d2,$parsedComplex1['suffix']);
2112
+		return self::COMPLEX($d1, $d2, $parsedComplex1['suffix']);
2113 2113
 	}	//	function IMSUB()
2114 2114
 
2115 2115
 
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
 		}
2146 2146
 
2147 2147
 		if ($returnValue['imaginary'] == 0.0) { $activeSuffix = ''; }
2148
-		return self::COMPLEX($returnValue['real'],$returnValue['imaginary'],$activeSuffix);
2148
+		return self::COMPLEX($returnValue['real'], $returnValue['imaginary'], $activeSuffix);
2149 2149
 	}	//	function IMSUM()
2150 2150
 
2151 2151
 
@@ -2181,7 +2181,7 @@  discard block
 block discarded – undo
2181 2181
 		}
2182 2182
 
2183 2183
 		if ($returnValue['imaginary'] == 0.0) { $activeSuffix = ''; }
2184
-		return self::COMPLEX($returnValue['real'],$returnValue['imaginary'],$activeSuffix);
2184
+		return self::COMPLEX($returnValue['real'], $returnValue['imaginary'], $activeSuffix);
2185 2185
 	}	//	function IMPRODUCT()
2186 2186
 
2187 2187
 
@@ -2200,7 +2200,7 @@  discard block
 block discarded – undo
2200 2200
 	 * @param	float		$b	The second number. If omitted, b is assumed to be zero.
2201 2201
 	 * @return	int
2202 2202
 	 */
2203
-	public static function DELTA($a, $b=0) {
2203
+	public static function DELTA($a, $b = 0) {
2204 2204
 		$a	= PHPExcel_Calculation_Functions::flattenSingleValue($a);
2205 2205
 		$b	= PHPExcel_Calculation_Functions::flattenSingleValue($b);
2206 2206
 
@@ -2223,9 +2223,9 @@  discard block
 block discarded – undo
2223 2223
 	 *									If you omit a value for step, GESTEP uses zero.
2224 2224
 	 * @return	int
2225 2225
 	 */
2226
-	public static function GESTEP($number, $step=0) {
2227
-		$number	= PHPExcel_Calculation_Functions::flattenSingleValue($number);
2228
-		$step	= PHPExcel_Calculation_Functions::flattenSingleValue($step);
2226
+	public static function GESTEP($number, $step = 0) {
2227
+		$number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
2228
+		$step = PHPExcel_Calculation_Functions::flattenSingleValue($step);
2229 2229
 
2230 2230
 		return (int) ($number >= $step);
2231 2231
 	}	//	function GESTEP()
@@ -2337,7 +2337,7 @@  discard block
 block discarded – undo
2337 2337
 	 * @return	int
2338 2338
 	 */
2339 2339
 	public static function ERFC($x) {
2340
-		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
2340
+		$x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
2341 2341
 
2342 2342
 		if (is_numeric($x)) {
2343 2343
 			if ($x < 0) {
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 	 */
2357 2357
 	public static function getConversionGroups() {
2358 2358
 		$conversionGroups = array();
2359
-		foreach(self::$_conversionUnits as $conversionUnit) {
2359
+		foreach (self::$_conversionUnits as $conversionUnit) {
2360 2360
 			$conversionGroups[] = $conversionUnit['Group'];
2361 2361
 		}
2362 2362
 		return array_merge(array_unique($conversionGroups));
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
 	 */
2371 2371
 	public static function getConversionGroupUnits($group = NULL) {
2372 2372
 		$conversionGroups = array();
2373
-		foreach(self::$_conversionUnits as $conversionUnit => $conversionGroup) {
2373
+		foreach (self::$_conversionUnits as $conversionUnit => $conversionGroup) {
2374 2374
 			if ((is_null($group)) || ($conversionGroup['Group'] == $group)) {
2375 2375
 				$conversionGroups[$conversionGroup['Group']][] = $conversionUnit;
2376 2376
 			}
@@ -2386,9 +2386,9 @@  discard block
 block discarded – undo
2386 2386
 	 */
2387 2387
 	public static function getConversionGroupUnitDetails($group = NULL) {
2388 2388
 		$conversionGroups = array();
2389
-		foreach(self::$_conversionUnits as $conversionUnit => $conversionGroup) {
2389
+		foreach (self::$_conversionUnits as $conversionUnit => $conversionGroup) {
2390 2390
 			if ((is_null($group)) || ($conversionGroup['Group'] == $group)) {
2391
-				$conversionGroups[$conversionGroup['Group']][] = array(	'unit'			=> $conversionUnit,
2391
+				$conversionGroups[$conversionGroup['Group']][] = array('unit'			=> $conversionUnit,
2392 2392
 																		'description'	=> $conversionGroup['Unit Name']
2393 2393
 																	  );
2394 2394
 			}
@@ -2424,18 +2424,18 @@  discard block
 block discarded – undo
2424 2424
 	 */
2425 2425
 	public static function CONVERTUOM($value, $fromUOM, $toUOM) {
2426 2426
 		$value		= PHPExcel_Calculation_Functions::flattenSingleValue($value);
2427
-		$fromUOM	= PHPExcel_Calculation_Functions::flattenSingleValue($fromUOM);
2427
+		$fromUOM = PHPExcel_Calculation_Functions::flattenSingleValue($fromUOM);
2428 2428
 		$toUOM		= PHPExcel_Calculation_Functions::flattenSingleValue($toUOM);
2429 2429
 
2430
-		if (!is_numeric($value)) {
2430
+		if ( ! is_numeric($value)) {
2431 2431
 			return PHPExcel_Calculation_Functions::VALUE();
2432 2432
 		}
2433 2433
 		$fromMultiplier = 1.0;
2434 2434
 		if (isset(self::$_conversionUnits[$fromUOM])) {
2435 2435
 			$unitGroup1 = self::$_conversionUnits[$fromUOM]['Group'];
2436 2436
 		} else {
2437
-			$fromMultiplier = substr($fromUOM,0,1);
2438
-			$fromUOM = substr($fromUOM,1);
2437
+			$fromMultiplier = substr($fromUOM, 0, 1);
2438
+			$fromUOM = substr($fromUOM, 1);
2439 2439
 			if (isset(self::$_conversionMultipliers[$fromMultiplier])) {
2440 2440
 				$fromMultiplier = self::$_conversionMultipliers[$fromMultiplier]['multiplier'];
2441 2441
 			} else {
@@ -2453,8 +2453,8 @@  discard block
 block discarded – undo
2453 2453
 		if (isset(self::$_conversionUnits[$toUOM])) {
2454 2454
 			$unitGroup2 = self::$_conversionUnits[$toUOM]['Group'];
2455 2455
 		} else {
2456
-			$toMultiplier = substr($toUOM,0,1);
2457
-			$toUOM = substr($toUOM,1);
2456
+			$toMultiplier = substr($toUOM, 0, 1);
2457
+			$toUOM = substr($toUOM, 1);
2458 2458
 			if (isset(self::$_conversionMultipliers[$toMultiplier])) {
2459 2459
 				$toMultiplier = self::$_conversionMultipliers[$toMultiplier]['multiplier'];
2460 2460
 			} else {
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -749,10 +749,18 @@  discard block
 block discarded – undo
749 749
 	 * @return	string		The "cleaned" complex number
750 750
 	 */
751 751
 	private static function _cleanComplex($complexNumber) {
752
-		if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber,1);
753
-		if ($complexNumber{0} == '0') $complexNumber = substr($complexNumber,1);
754
-		if ($complexNumber{0} == '.') $complexNumber = '0'.$complexNumber;
755
-		if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber,1);
752
+		if ($complexNumber{0} == '+') {
753
+			$complexNumber = substr($complexNumber,1);
754
+		}
755
+		if ($complexNumber{0} == '0') {
756
+			$complexNumber = substr($complexNumber,1);
757
+		}
758
+		if ($complexNumber{0} == '.') {
759
+			$complexNumber = '0'.$complexNumber;
760
+		}
761
+		if ($complexNumber{0} == '+') {
762
+			$complexNumber = substr($complexNumber,1);
763
+		}
756 764
 		return $complexNumber;
757 765
 	}
758 766
 
@@ -1658,7 +1666,9 @@  discard block
 block discarded – undo
1658 1666
 			$realNumber	= (float) $realNumber;
1659 1667
 			$imaginary	= (float) $imaginary;
1660 1668
 
1661
-			if ($suffix == '') $suffix = 'i';
1669
+			if ($suffix == '') {
1670
+				$suffix = 'i';
1671
+			}
1662 1672
 			if ($realNumber == 0.0) {
1663 1673
 				if ($imaginary == 0.0) {
1664 1674
 					return (string) '0';
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Calculation/Financial.php 4 patches
Doc Comments   +28 added lines, -17 removed lines patch added patch discarded remove patch
@@ -80,6 +80,10 @@  discard block
 block discarded – undo
80 80
 	}	//	function _firstDayOfMonth()
81 81
 
82 82
 
83
+	/**
84
+	 * @param integer $frequency
85
+	 * @param boolean $next
86
+	 */
83 87
 	private static function _coupFirstPeriodDate($settlement, $maturity, $frequency, $next)
84 88
 	{
85 89
 		$months = 12 / $frequency;
@@ -102,6 +106,9 @@  discard block
 block discarded – undo
102 106
 	}	//	function _coupFirstPeriodDate()
103 107
 
104 108
 
109
+	/**
110
+	 * @param integer $frequency
111
+	 */
105 112
 	private static function _validFrequency($frequency)
106 113
 	{
107 114
 		if (($frequency == 1) || ($frequency == 2) || ($frequency == 4)) {
@@ -179,7 +186,7 @@  discard block
 block discarded – undo
179 186
 	 *									The security settlement date is the date after the issue date
180 187
 	 *									when the security is traded to the buyer.
181 188
 	 * @param	float	$rate			The security's annual coupon rate.
182
-	 * @param	float	$par			The security's par value.
189
+	 * @param	integer	$par			The security's par value.
183 190
 	 *									If you omit par, ACCRINT uses $1,000.
184 191
 	 * @param	integer	$frequency		the number of coupon payments per year.
185 192
 	 *									Valid frequency values are:
@@ -446,6 +453,7 @@  discard block
 block discarded – undo
446 453
 	 *										2				Actual/360
447 454
 	 *										3				Actual/365
448 455
 	 *										4				European 30/360
456
+	 * @param integer $frequency
449 457
 	 * @return	float
450 458
 	 */
451 459
 	public static function COUPDAYBS($settlement, $maturity, $frequency, $basis=0) {
@@ -504,6 +512,7 @@  discard block
 block discarded – undo
504 512
 	 *										2				Actual/360
505 513
 	 *										3				Actual/365
506 514
 	 *										4				European 30/360
515
+	 * @param integer $frequency
507 516
 	 * @return	float
508 517
 	 */
509 518
 	public static function COUPDAYS($settlement, $maturity, $frequency, $basis=0) {
@@ -574,6 +583,7 @@  discard block
 block discarded – undo
574 583
 	 *										2				Actual/360
575 584
 	 *										3				Actual/365
576 585
 	 *										4				European 30/360
586
+	 * @param integer $frequency
577 587
 	 * @return	float
578 588
 	 */
579 589
 	public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis=0) {
@@ -689,6 +699,7 @@  discard block
 block discarded – undo
689 699
 	 *										2				Actual/360
690 700
 	 *										3				Actual/365
691 701
 	 *										4				European 30/360
702
+	 * @param integer $frequency
692 703
 	 * @return	integer
693 704
 	 */
694 705
 	public static function COUPNUM($settlement, $maturity, $frequency, $basis=0) {
@@ -1143,7 +1154,7 @@  discard block
 block discarded – undo
1143 1154
 	 *
1144 1155
 	 * @access	public
1145 1156
 	 * @category Financial Functions
1146
-	 * @param	float	$nominal_rate		Nominal interest rate
1157
+	 * @param	integer	$nominal_rate		Nominal interest rate
1147 1158
 	 * @param	integer	$npery				Number of compounding payments per year
1148 1159
 	 * @return	float
1149 1160
 	 */
@@ -1170,12 +1181,12 @@  discard block
 block discarded – undo
1170 1181
 	 *
1171 1182
 	 * @access	public
1172 1183
 	 * @category Financial Functions
1173
-	 * @param	float	$rate	The interest rate per period
1184
+	 * @param	integer	$rate	The interest rate per period
1174 1185
 	 * @param	int		$nper	Total number of payment periods in an annuity
1175
-	 * @param	float	$pmt	The payment made each period: it cannot change over the
1186
+	 * @param	integer	$pmt	The payment made each period: it cannot change over the
1176 1187
 	 *							life of the annuity. Typically, pmt contains principal
1177 1188
 	 *							and interest but no other fees or taxes.
1178
-	 * @param	float	$pv		Present Value, or the lump-sum amount that a series of
1189
+	 * @param	integer	$pv		Present Value, or the lump-sum amount that a series of
1179 1190
 	 *							future payments is worth right now.
1180 1191
 	 * @param	integer	$type	A number 0 or 1 and indicates when payments are due:
1181 1192
 	 *								0 or omitted	At the end of the period.
@@ -1277,7 +1288,7 @@  discard block
 block discarded – undo
1277 1288
 	 * @param	int		$per	Period for which we want to find the interest
1278 1289
 	 * @param	int		$nper	Number of periods
1279 1290
 	 * @param	float	$pv		Present Value
1280
-	 * @param	float	$fv		Future Value
1291
+	 * @param	integer	$fv		Future Value
1281 1292
 	 * @param	int		$type	Payment type: 0 = at the end of each period, 1 = at the beginning of each period
1282 1293
 	 * @return	float
1283 1294
 	 */
@@ -1419,7 +1430,7 @@  discard block
 block discarded – undo
1419 1430
 	 *
1420 1431
 	 * Returns the nominal interest rate given the effective rate and the number of compounding payments per year.
1421 1432
 	 *
1422
-	 * @param	float	$effect_rate	Effective interest rate
1433
+	 * @param	integer	$effect_rate	Effective interest rate
1423 1434
 	 * @param	int		$npery			Number of compounding payments per year
1424 1435
 	 * @return	float
1425 1436
 	 */
@@ -1442,10 +1453,10 @@  discard block
 block discarded – undo
1442 1453
 	 *
1443 1454
 	 * Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate.
1444 1455
 	 *
1445
-	 * @param	float	$rate	Interest rate per period
1456
+	 * @param	integer	$rate	Interest rate per period
1446 1457
 	 * @param	int		$pmt	Periodic payment (annuity)
1447
-	 * @param	float	$pv		Present Value
1448
-	 * @param	float	$fv		Future Value
1458
+	 * @param	integer	$pv		Present Value
1459
+	 * @param	integer	$fv		Future Value
1449 1460
 	 * @param	int		$type	Payment type: 0 = at the end of each period, 1 = at the beginning of each period
1450 1461
 	 * @return	float
1451 1462
 	 */
@@ -1511,10 +1522,10 @@  discard block
 block discarded – undo
1511 1522
 	 *
1512 1523
 	 * Returns the constant payment (annuity) for a cash flow with a constant interest rate.
1513 1524
 	 *
1514
-	 * @param	float	$rate	Interest rate per period
1525
+	 * @param	integer	$rate	Interest rate per period
1515 1526
 	 * @param	int		$nper	Number of periods
1516
-	 * @param	float	$pv		Present Value
1517
-	 * @param	float	$fv		Future Value
1527
+	 * @param	integer	$pv		Present Value
1528
+	 * @param	integer	$fv		Future Value
1518 1529
 	 * @param	int		$type	Payment type: 0 = at the end of each period, 1 = at the beginning of each period
1519 1530
 	 * @return	float
1520 1531
 	 */
@@ -1548,7 +1559,7 @@  discard block
 block discarded – undo
1548 1559
 	 * @param	int		$per	Period for which we want to find the interest
1549 1560
 	 * @param	int		$nper	Number of periods
1550 1561
 	 * @param	float	$pv		Present Value
1551
-	 * @param	float	$fv		Future Value
1562
+	 * @param	integer	$fv		Future Value
1552 1563
 	 * @param	int		$type	Payment type: 0 = at the end of each period, 1 = at the beginning of each period
1553 1564
 	 * @return	float
1554 1565
 	 */
@@ -1727,10 +1738,10 @@  discard block
 block discarded – undo
1727 1738
 	 *
1728 1739
 	 * Returns the Present Value of a cash flow with constant payments and interest rate (annuities).
1729 1740
 	 *
1730
-	 * @param	float	$rate	Interest rate per period
1741
+	 * @param	integer	$rate	Interest rate per period
1731 1742
 	 * @param	int		$nper	Number of periods
1732
-	 * @param	float	$pmt	Periodic payment (annuity)
1733
-	 * @param	float	$fv		Future Value
1743
+	 * @param	integer	$pmt	Periodic payment (annuity)
1744
+	 * @param	integer	$fv		Future Value
1734 1745
 	 * @param	int		$type	Payment type: 0 = at the end of each period, 1 = at the beginning of each period
1735 1746
 	 * @return	float
1736 1747
 	 */
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * PHPExcel
4
- *
5
- * Copyright (c) 2006 - 2012 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 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
24
- * @license		http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
25
- * @version		1.7.7, 2012-05-19
26
- */
3
+	 * PHPExcel
4
+	 *
5
+	 * Copyright (c) 2006 - 2012 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 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
24
+	 * @license		http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
25
+	 * @version		1.7.7, 2012-05-19
26
+	 */
27 27
 
28 28
 
29 29
 /** PHPExcel root directory */
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 		} elseif ($period <= $nNumOfFullPeriods) {
410 410
 			return $fOneRate;
411 411
 		} elseif ($period == ($nNumOfFullPeriods + 1)) {
412
-            return ($fCostDelta - $fOneRate * $nNumOfFullPeriods - $f0Rate);
412
+			return ($fCostDelta - $fOneRate * $nNumOfFullPeriods - $f0Rate);
413 413
 		} else {
414 414
 			return 0.0;
415 415
 		}
Please login to merge, or discard this patch.
Spacing   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
 
29 29
 /** PHPExcel root directory */
30
-if (!defined('PHPEXCEL_ROOT')) {
30
+if ( ! defined('PHPEXCEL_ROOT')) {
31 31
 	/**
32 32
 	 * @ignore
33 33
 	 */
34
-	define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
35
-	require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
34
+	define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../');
35
+	require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php');
36 36
 }
37 37
 
38 38
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 *									4						European 360
130 130
 	 * @return	integer
131 131
 	 */
132
-	private static function _daysPerYear($year, $basis=0)
132
+	private static function _daysPerYear($year, $basis = 0)
133 133
 	{
134 134
 		switch ($basis) {
135 135
 			case 0 :
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 	}	//	function _daysPerYear()
151 151
 
152 152
 
153
-	private static function _interestAndPrincipal($rate=0, $per=0, $nper=0, $pv=0, $fv=0, $type=0)
153
+	private static function _interestAndPrincipal($rate = 0, $per = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0)
154 154
 	{
155 155
 		$pmt = self::PMT($rate, $nper, $pv, $fv, $type);
156 156
 		$capital = $pv;
157
-		for ($i = 1; $i<= $per; ++$i) {
157
+		for ($i = 1; $i <= $per; ++$i) {
158 158
 			$interest = ($type && $i == 1) ? 0 : -$capital * $rate;
159 159
 			$principal = $pmt - $interest;
160 160
 			$capital += $principal;
@@ -198,25 +198,25 @@  discard block
 block discarded – undo
198 198
 	 *										4				European 30/360
199 199
 	 * @return	float
200 200
 	 */
201
-	public static function ACCRINT($issue, $firstinterest, $settlement, $rate, $par=1000, $frequency=1, $basis=0)
201
+	public static function ACCRINT($issue, $firstinterest, $settlement, $rate, $par = 1000, $frequency = 1, $basis = 0)
202 202
 	{
203
-		$issue		= PHPExcel_Calculation_Functions::flattenSingleValue($issue);
204
-		$firstinterest	= PHPExcel_Calculation_Functions::flattenSingleValue($firstinterest);
205
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
206
-		$rate		= PHPExcel_Calculation_Functions::flattenSingleValue($rate);
207
-		$par		= (is_null($par))		? 1000 :	PHPExcel_Calculation_Functions::flattenSingleValue($par);
208
-		$frequency	= (is_null($frequency))	? 1	: 		PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
209
-		$basis		= (is_null($basis))		? 0	:		PHPExcel_Calculation_Functions::flattenSingleValue($basis);
203
+		$issue = PHPExcel_Calculation_Functions::flattenSingleValue($issue);
204
+		$firstinterest = PHPExcel_Calculation_Functions::flattenSingleValue($firstinterest);
205
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
206
+		$rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
207
+		$par = (is_null($par)) ? 1000 : PHPExcel_Calculation_Functions::flattenSingleValue($par);
208
+		$frequency = (is_null($frequency)) ? 1 : PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
209
+		$basis = (is_null($basis)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($basis);
210 210
 
211 211
 		//	Validate
212 212
 		if ((is_numeric($rate)) && (is_numeric($par))) {
213
-			$rate	= (float) $rate;
214
-			$par	= (float) $par;
213
+			$rate = (float) $rate;
214
+			$par = (float) $par;
215 215
 			if (($rate <= 0) || ($par <= 0)) {
216 216
 				return PHPExcel_Calculation_Functions::NaN();
217 217
 			}
218 218
 			$daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
219
-			if (!is_numeric($daysBetweenIssueAndSettlement)) {
219
+			if ( ! is_numeric($daysBetweenIssueAndSettlement)) {
220 220
 				//	return date error
221 221
 				return $daysBetweenIssueAndSettlement;
222 222
 			}
@@ -250,22 +250,22 @@  discard block
 block discarded – undo
250 250
 	 *										4				European 30/360
251 251
 	 * @return	float
252 252
 	 */
253
-	public static function ACCRINTM($issue, $settlement, $rate, $par=1000, $basis=0) {
254
-		$issue		= PHPExcel_Calculation_Functions::flattenSingleValue($issue);
255
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
256
-		$rate		= PHPExcel_Calculation_Functions::flattenSingleValue($rate);
257
-		$par		= (is_null($par))	? 1000 :	PHPExcel_Calculation_Functions::flattenSingleValue($par);
258
-		$basis		= (is_null($basis))	? 0 :		PHPExcel_Calculation_Functions::flattenSingleValue($basis);
253
+	public static function ACCRINTM($issue, $settlement, $rate, $par = 1000, $basis = 0) {
254
+		$issue = PHPExcel_Calculation_Functions::flattenSingleValue($issue);
255
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
256
+		$rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
257
+		$par = (is_null($par)) ? 1000 : PHPExcel_Calculation_Functions::flattenSingleValue($par);
258
+		$basis = (is_null($basis)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($basis);
259 259
 
260 260
 		//	Validate
261 261
 		if ((is_numeric($rate)) && (is_numeric($par))) {
262
-			$rate	= (float) $rate;
263
-			$par	= (float) $par;
262
+			$rate = (float) $rate;
263
+			$par = (float) $par;
264 264
 			if (($rate <= 0) || ($par <= 0)) {
265 265
 				return PHPExcel_Calculation_Functions::NaN();
266 266
 			}
267 267
 			$daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
268
-			if (!is_numeric($daysBetweenIssueAndSettlement)) {
268
+			if ( ! is_numeric($daysBetweenIssueAndSettlement)) {
269 269
 				//	return date error
270 270
 				return $daysBetweenIssueAndSettlement;
271 271
 			}
@@ -306,14 +306,14 @@  discard block
 block discarded – undo
306 306
 	 *										4				European 30/360
307 307
 	 * @return	float
308 308
 	 */
309
-	public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0) {
310
-		$cost			= PHPExcel_Calculation_Functions::flattenSingleValue($cost);
311
-		$purchased		= PHPExcel_Calculation_Functions::flattenSingleValue($purchased);
312
-		$firstPeriod	= PHPExcel_Calculation_Functions::flattenSingleValue($firstPeriod);
309
+	public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0) {
310
+		$cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
311
+		$purchased = PHPExcel_Calculation_Functions::flattenSingleValue($purchased);
312
+		$firstPeriod = PHPExcel_Calculation_Functions::flattenSingleValue($firstPeriod);
313 313
 		$salvage		= PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
314 314
 		$period			= floor(PHPExcel_Calculation_Functions::flattenSingleValue($period));
315
-		$rate			= PHPExcel_Calculation_Functions::flattenSingleValue($rate);
316
-		$basis			= (is_null($basis))	? 0 :	(int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
315
+		$rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
316
+		$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
317 317
 
318 318
 		//	The depreciation coefficients are:
319 319
 		//	Life of assets (1/rate)		Depreciation coefficient
@@ -333,12 +333,12 @@  discard block
 block discarded – undo
333 333
 		}
334 334
 
335 335
 		$rate *= $amortiseCoeff;
336
-		$fNRate = round(PHPExcel_Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis) * $rate * $cost,0);
336
+		$fNRate = round(PHPExcel_Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis) * $rate * $cost, 0);
337 337
 		$cost -= $fNRate;
338 338
 		$fRest = $cost - $salvage;
339 339
 
340 340
 		for ($n = 0; $n < $period; ++$n) {
341
-			$fNRate = round($rate * $cost,0);
341
+			$fNRate = round($rate * $cost, 0);
342 342
 			$fRest -= $fNRate;
343 343
 
344 344
 			if ($fRest < 0.0) {
@@ -382,14 +382,14 @@  discard block
 block discarded – undo
382 382
 	 *										4				European 30/360
383 383
 	 * @return	float
384 384
 	 */
385
-	public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0) {
386
-		$cost			= PHPExcel_Calculation_Functions::flattenSingleValue($cost);
387
-		$purchased		= PHPExcel_Calculation_Functions::flattenSingleValue($purchased);
388
-		$firstPeriod	= PHPExcel_Calculation_Functions::flattenSingleValue($firstPeriod);
385
+	public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0) {
386
+		$cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
387
+		$purchased = PHPExcel_Calculation_Functions::flattenSingleValue($purchased);
388
+		$firstPeriod = PHPExcel_Calculation_Functions::flattenSingleValue($firstPeriod);
389 389
 		$salvage		= PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
390 390
 		$period			= PHPExcel_Calculation_Functions::flattenSingleValue($period);
391
-		$rate			= PHPExcel_Calculation_Functions::flattenSingleValue($rate);
392
-		$basis			= (is_null($basis))	? 0 :	(int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
391
+		$rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
392
+		$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
393 393
 
394 394
 		$fOneRate = $cost * $rate;
395 395
 		$fCostDelta = $cost - $salvage;
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
 	 *										4				European 30/360
449 449
 	 * @return	float
450 450
 	 */
451
-	public static function COUPDAYBS($settlement, $maturity, $frequency, $basis=0) {
452
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
453
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
454
-		$frequency	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
455
-		$basis		= (is_null($basis))	? 0 :	(int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
451
+	public static function COUPDAYBS($settlement, $maturity, $frequency, $basis = 0) {
452
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
453
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
454
+		$frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
455
+		$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
456 456
 
457 457
 		if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
458 458
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -462,12 +462,12 @@  discard block
 block discarded – undo
462 462
 		}
463 463
 
464 464
 		if (($settlement > $maturity) ||
465
-			(!self::_validFrequency($frequency)) ||
465
+			( ! self::_validFrequency($frequency)) ||
466 466
 			(($basis < 0) || ($basis > 4))) {
467 467
 			return PHPExcel_Calculation_Functions::NaN();
468 468
 		}
469 469
 
470
-		$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis);
470
+		$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
471 471
 		$prev = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, False);
472 472
 
473 473
 		return PHPExcel_Calculation_DateTime::YEARFRAC($prev, $settlement, $basis) * $daysPerYear;
@@ -506,11 +506,11 @@  discard block
 block discarded – undo
506 506
 	 *										4				European 30/360
507 507
 	 * @return	float
508 508
 	 */
509
-	public static function COUPDAYS($settlement, $maturity, $frequency, $basis=0) {
510
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
511
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
512
-		$frequency	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
513
-		$basis		= (is_null($basis))	? 0 :	(int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
509
+	public static function COUPDAYS($settlement, $maturity, $frequency, $basis = 0) {
510
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
511
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
512
+		$frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
513
+		$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
514 514
 
515 515
 		if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
516 516
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		}
521 521
 
522 522
 		if (($settlement > $maturity) ||
523
-			(!self::_validFrequency($frequency)) ||
523
+			( ! self::_validFrequency($frequency)) ||
524 524
 			(($basis < 0) || ($basis > 4))) {
525 525
 			return PHPExcel_Calculation_Functions::NaN();
526 526
 		}
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 					return 365 / $frequency;
531 531
 			case 1: // Actual/actual
532 532
 					if ($frequency == 1) {
533
-						$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($maturity),$basis);
533
+						$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($maturity), $basis);
534 534
 						return ($daysPerYear / $frequency);
535 535
 					} else {
536 536
 						$prev = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, False);
@@ -576,11 +576,11 @@  discard block
 block discarded – undo
576 576
 	 *										4				European 30/360
577 577
 	 * @return	float
578 578
 	 */
579
-	public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis=0) {
580
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
581
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
582
-		$frequency	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
583
-		$basis		= (is_null($basis))	? 0 :	(int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
579
+	public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis = 0) {
580
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
581
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
582
+		$frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
583
+		$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
584 584
 
585 585
 		if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
586 586
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
 		}
591 591
 
592 592
 		if (($settlement > $maturity) ||
593
-			(!self::_validFrequency($frequency)) ||
593
+			( ! self::_validFrequency($frequency)) ||
594 594
 			(($basis < 0) || ($basis > 4))) {
595 595
 			return PHPExcel_Calculation_Functions::NaN();
596 596
 		}
597 597
 
598
-		$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis);
598
+		$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
599 599
 		$next = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, True);
600 600
 
601 601
 		return PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $next, $basis) * $daysPerYear;
@@ -635,11 +635,11 @@  discard block
 block discarded – undo
635 635
 	 * @return	mixed	Excel date/time serial value, PHP date/time serial value or PHP date/time object,
636 636
 	 *						depending on the value of the ReturnDateType flag
637 637
 	 */
638
-	public static function COUPNCD($settlement, $maturity, $frequency, $basis=0) {
639
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
640
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
641
-		$frequency	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
642
-		$basis		= (is_null($basis))	? 0 :	(int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
638
+	public static function COUPNCD($settlement, $maturity, $frequency, $basis = 0) {
639
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
640
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
641
+		$frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
642
+		$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
643 643
 
644 644
 		if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
645 645
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 		}
650 650
 
651 651
 		if (($settlement > $maturity) ||
652
-			(!self::_validFrequency($frequency)) ||
652
+			( ! self::_validFrequency($frequency)) ||
653 653
 			(($basis < 0) || ($basis > 4))) {
654 654
 			return PHPExcel_Calculation_Functions::NaN();
655 655
 		}
@@ -691,11 +691,11 @@  discard block
 block discarded – undo
691 691
 	 *										4				European 30/360
692 692
 	 * @return	integer
693 693
 	 */
694
-	public static function COUPNUM($settlement, $maturity, $frequency, $basis=0) {
695
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
696
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
697
-		$frequency	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
698
-		$basis		= (is_null($basis))	? 0 :	(int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
694
+	public static function COUPNUM($settlement, $maturity, $frequency, $basis = 0) {
695
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
696
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
697
+		$frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
698
+		$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
699 699
 
700 700
 		if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
701 701
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 		}
706 706
 
707 707
 		if (($settlement > $maturity) ||
708
-			(!self::_validFrequency($frequency)) ||
708
+			( ! self::_validFrequency($frequency)) ||
709 709
 			(($basis < 0) || ($basis > 4))) {
710 710
 			return PHPExcel_Calculation_Functions::NaN();
711 711
 		}
@@ -762,11 +762,11 @@  discard block
 block discarded – undo
762 762
 	 * @return	mixed	Excel date/time serial value, PHP date/time serial value or PHP date/time object,
763 763
 	 *						depending on the value of the ReturnDateType flag
764 764
 	 */
765
-	public static function COUPPCD($settlement, $maturity, $frequency, $basis=0) {
766
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
767
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
768
-		$frequency	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
769
-		$basis		= (is_null($basis))	? 0 :	(int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
765
+	public static function COUPPCD($settlement, $maturity, $frequency, $basis = 0) {
766
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
767
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
768
+		$frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
769
+		$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
770 770
 
771 771
 		if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
772 772
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 		}
777 777
 
778 778
 		if (($settlement > $maturity) ||
779
-			(!self::_validFrequency($frequency)) ||
779
+			( ! self::_validFrequency($frequency)) ||
780 780
 			(($basis < 0) || ($basis > 4))) {
781 781
 			return PHPExcel_Calculation_Functions::NaN();
782 782
 		}
@@ -810,9 +810,9 @@  discard block
 block discarded – undo
810 810
 		$rate	= PHPExcel_Calculation_Functions::flattenSingleValue($rate);
811 811
 		$nper	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
812 812
 		$pv		= PHPExcel_Calculation_Functions::flattenSingleValue($pv);
813
-		$start	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($start);
813
+		$start = (int) PHPExcel_Calculation_Functions::flattenSingleValue($start);
814 814
 		$end	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($end);
815
-		$type	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
815
+		$type = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
816 816
 
817 817
 		// Validate parameters
818 818
 		if ($type != 0 && $type != 1) {
@@ -857,9 +857,9 @@  discard block
 block discarded – undo
857 857
 		$rate	= PHPExcel_Calculation_Functions::flattenSingleValue($rate);
858 858
 		$nper	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
859 859
 		$pv		= PHPExcel_Calculation_Functions::flattenSingleValue($pv);
860
-		$start	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($start);
860
+		$start = (int) PHPExcel_Calculation_Functions::flattenSingleValue($start);
861 861
 		$end	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($end);
862
-		$type	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
862
+		$type = (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
863 863
 
864 864
 		// Validate parameters
865 865
 		if ($type != 0 && $type != 1) {
@@ -905,12 +905,12 @@  discard block
 block discarded – undo
905 905
 	 *								it defaults to 12.
906 906
 	 * @return	float
907 907
 	 */
908
-	public static function DB($cost, $salvage, $life, $period, $month=12) {
908
+	public static function DB($cost, $salvage, $life, $period, $month = 12) {
909 909
 		$cost		= PHPExcel_Calculation_Functions::flattenSingleValue($cost);
910 910
 		$salvage	= PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
911 911
 		$life		= PHPExcel_Calculation_Functions::flattenSingleValue($life);
912 912
 		$period		= PHPExcel_Calculation_Functions::flattenSingleValue($period);
913
-		$month		= PHPExcel_Calculation_Functions::flattenSingleValue($month);
913
+		$month = PHPExcel_Calculation_Functions::flattenSingleValue($month);
914 914
 
915 915
 		//	Validate
916 916
 		if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) {
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 			$salvage	= (float) $salvage;
919 919
 			$life		= (int) $life;
920 920
 			$period		= (int) $period;
921
-			$month		= (int) $month;
921
+			$month = (int) $month;
922 922
 			if ($cost == 0) {
923 923
 				return 0.0;
924 924
 			} elseif (($cost < 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($month < 1)) {
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 				$previousDepreciation += $depreciation;
942 942
 			}
943 943
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
944
-				$depreciation = round($depreciation,2);
944
+				$depreciation = round($depreciation, 2);
945 945
 			}
946 946
 			return $depreciation;
947 947
 		}
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 	 *								double-declining balance method).
973 973
 	 * @return	float
974 974
 	 */
975
-	public static function DDB($cost, $salvage, $life, $period, $factor=2.0) {
975
+	public static function DDB($cost, $salvage, $life, $period, $factor = 2.0) {
976 976
 		$cost		= PHPExcel_Calculation_Functions::flattenSingleValue($cost);
977 977
 		$salvage	= PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
978 978
 		$life		= PHPExcel_Calculation_Functions::flattenSingleValue($life);
@@ -996,11 +996,11 @@  discard block
 block discarded – undo
996 996
 			//	Loop through each period calculating the depreciation
997 997
 			$previousDepreciation = 0;
998 998
 			for ($per = 1; $per <= $period; ++$per) {
999
-				$depreciation = min( ($cost - $previousDepreciation) * ($factor / $life), ($cost - $salvage - $previousDepreciation) );
999
+				$depreciation = min(($cost - $previousDepreciation) * ($factor / $life), ($cost - $salvage - $previousDepreciation));
1000 1000
 				$previousDepreciation += $depreciation;
1001 1001
 			}
1002 1002
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
1003
-				$depreciation = round($depreciation,2);
1003
+				$depreciation = round($depreciation, 2);
1004 1004
 			}
1005 1005
 			return $depreciation;
1006 1006
 		}
@@ -1033,9 +1033,9 @@  discard block
 block discarded – undo
1033 1033
 	 *										4				European 30/360
1034 1034
 	 * @return	float
1035 1035
 	 */
1036
-	public static function DISC($settlement, $maturity, $price, $redemption, $basis=0) {
1036
+	public static function DISC($settlement, $maturity, $price, $redemption, $basis = 0) {
1037 1037
 		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1038
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1038
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1039 1039
 		$price		= PHPExcel_Calculation_Functions::flattenSingleValue($price);
1040 1040
 		$redemption	= PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
1041 1041
 		$basis		= PHPExcel_Calculation_Functions::flattenSingleValue($basis);
@@ -1043,13 +1043,13 @@  discard block
 block discarded – undo
1043 1043
 		//	Validate
1044 1044
 		if ((is_numeric($price)) && (is_numeric($redemption)) && (is_numeric($basis))) {
1045 1045
 			$price		= (float) $price;
1046
-			$redemption	= (float) $redemption;
1046
+			$redemption = (float) $redemption;
1047 1047
 			$basis		= (int) $basis;
1048 1048
 			if (($price <= 0) || ($redemption <= 0)) {
1049 1049
 				return PHPExcel_Calculation_Functions::NaN();
1050 1050
 			}
1051 1051
 			$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
1052
-			if (!is_numeric($daysBetweenSettlementAndMaturity)) {
1052
+			if ( ! is_numeric($daysBetweenSettlementAndMaturity)) {
1053 1053
 				//	return date error
1054 1054
 				return $daysBetweenSettlementAndMaturity;
1055 1055
 			}
@@ -1077,8 +1077,8 @@  discard block
 block discarded – undo
1077 1077
 	 * @return	float
1078 1078
 	 */
1079 1079
 	public static function DOLLARDE($fractional_dollar = Null, $fraction = 0) {
1080
-		$fractional_dollar	= PHPExcel_Calculation_Functions::flattenSingleValue($fractional_dollar);
1081
-		$fraction			= (int)PHPExcel_Calculation_Functions::flattenSingleValue($fraction);
1080
+		$fractional_dollar = PHPExcel_Calculation_Functions::flattenSingleValue($fractional_dollar);
1081
+		$fraction = (int) PHPExcel_Calculation_Functions::flattenSingleValue($fraction);
1082 1082
 
1083 1083
 		// Validate parameters
1084 1084
 		if (is_null($fractional_dollar) || $fraction < 0) {
@@ -1089,9 +1089,9 @@  discard block
 block discarded – undo
1089 1089
 		}
1090 1090
 
1091 1091
 		$dollars = floor($fractional_dollar);
1092
-		$cents = fmod($fractional_dollar,1);
1092
+		$cents = fmod($fractional_dollar, 1);
1093 1093
 		$cents /= $fraction;
1094
-		$cents *= pow(10,ceil(log10($fraction)));
1094
+		$cents *= pow(10, ceil(log10($fraction)));
1095 1095
 		return $dollars + $cents;
1096 1096
 	}	//	function DOLLARDE()
1097 1097
 
@@ -1113,8 +1113,8 @@  discard block
 block discarded – undo
1113 1113
 	 * @return	float
1114 1114
 	 */
1115 1115
 	public static function DOLLARFR($decimal_dollar = Null, $fraction = 0) {
1116
-		$decimal_dollar	= PHPExcel_Calculation_Functions::flattenSingleValue($decimal_dollar);
1117
-		$fraction		= (int)PHPExcel_Calculation_Functions::flattenSingleValue($fraction);
1116
+		$decimal_dollar = PHPExcel_Calculation_Functions::flattenSingleValue($decimal_dollar);
1117
+		$fraction = (int) PHPExcel_Calculation_Functions::flattenSingleValue($fraction);
1118 1118
 
1119 1119
 		// Validate parameters
1120 1120
 		if (is_null($decimal_dollar) || $fraction < 0) {
@@ -1125,9 +1125,9 @@  discard block
 block discarded – undo
1125 1125
 		}
1126 1126
 
1127 1127
 		$dollars = floor($decimal_dollar);
1128
-		$cents = fmod($decimal_dollar,1);
1128
+		$cents = fmod($decimal_dollar, 1);
1129 1129
 		$cents *= $fraction;
1130
-		$cents *= pow(10,-ceil(log10($fraction)));
1130
+		$cents *= pow(10, -ceil(log10($fraction)));
1131 1131
 		return $dollars + $cents;
1132 1132
 	}	//	function DOLLARFR()
1133 1133
 
@@ -1148,8 +1148,8 @@  discard block
 block discarded – undo
1148 1148
 	 * @return	float
1149 1149
 	 */
1150 1150
 	public static function EFFECT($nominal_rate = 0, $npery = 0) {
1151
-		$nominal_rate	= PHPExcel_Calculation_Functions::flattenSingleValue($nominal_rate);
1152
-		$npery			= (int)PHPExcel_Calculation_Functions::flattenSingleValue($npery);
1151
+		$nominal_rate = PHPExcel_Calculation_Functions::flattenSingleValue($nominal_rate);
1152
+		$npery = (int) PHPExcel_Calculation_Functions::flattenSingleValue($npery);
1153 1153
 
1154 1154
 		// Validate parameters
1155 1155
 		if ($nominal_rate <= 0 || $npery < 1) {
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 		}
1196 1196
 
1197 1197
 		// Calculate
1198
-		if (!is_null($rate) && $rate != 0) {
1198
+		if ( ! is_null($rate) && $rate != 0) {
1199 1199
 			return -$pv * pow(1 + $rate, $nper) - $pmt * (1 + $rate * $type) * (pow(1 + $rate, $nper) - 1) / $rate;
1200 1200
 		} else {
1201 1201
 			return -$pv - $pmt * $nper;
@@ -1208,10 +1208,10 @@  discard block
 block discarded – undo
1208 1208
 	 *
1209 1209
 	 */
1210 1210
 	public static function FVSCHEDULE($principal, $schedule) {
1211
-		$principal	= PHPExcel_Calculation_Functions::flattenSingleValue($principal);
1212
-		$schedule	= PHPExcel_Calculation_Functions::flattenArray($schedule);
1211
+		$principal = PHPExcel_Calculation_Functions::flattenSingleValue($principal);
1212
+		$schedule = PHPExcel_Calculation_Functions::flattenArray($schedule);
1213 1213
 
1214
-		foreach($schedule as $n) {
1214
+		foreach ($schedule as $n) {
1215 1215
 			$principal *= 1 + $n;
1216 1216
 		}
1217 1217
 
@@ -1241,23 +1241,23 @@  discard block
 block discarded – undo
1241 1241
 	 *										4				European 30/360
1242 1242
 	 * @return	float
1243 1243
 	 */
1244
-	public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis=0) {
1244
+	public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis = 0) {
1245 1245
 		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1246
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1246
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1247 1247
 		$investment	= PHPExcel_Calculation_Functions::flattenSingleValue($investment);
1248 1248
 		$redemption	= PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
1249
-		$basis		= PHPExcel_Calculation_Functions::flattenSingleValue($basis);
1249
+		$basis = PHPExcel_Calculation_Functions::flattenSingleValue($basis);
1250 1250
 
1251 1251
 		//	Validate
1252 1252
 		if ((is_numeric($investment)) && (is_numeric($redemption)) && (is_numeric($basis))) {
1253 1253
 			$investment	= (float) $investment;
1254 1254
 			$redemption	= (float) $redemption;
1255
-			$basis		= (int) $basis;
1255
+			$basis = (int) $basis;
1256 1256
 			if (($investment <= 0) || ($redemption <= 0)) {
1257 1257
 				return PHPExcel_Calculation_Functions::NaN();
1258 1258
 			}
1259 1259
 			$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
1260
-			if (!is_numeric($daysBetweenSettlementAndMaturity)) {
1260
+			if ( ! is_numeric($daysBetweenSettlementAndMaturity)) {
1261 1261
 				//	return date error
1262 1262
 				return $daysBetweenSettlementAndMaturity;
1263 1263
 			}
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 
1305 1305
 
1306 1306
 	public static function IRR($values, $guess = 0.1) {
1307
-		if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
1307
+		if ( ! is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
1308 1308
 		$values = PHPExcel_Calculation_Functions::flattenArray($values);
1309 1309
 		$guess = PHPExcel_Calculation_Functions::flattenSingleValue($guess);
1310 1310
 
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
 			$dx = $x1 - $x2;
1333 1333
 		}
1334 1334
 
1335
-		for ($i = 0;  $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
1335
+		for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
1336 1336
 			$dx *= 0.5;
1337 1337
 			$x_mid = $rtb + $dx;
1338 1338
 			$f_mid = self::NPV($x_mid, $values);
@@ -1372,11 +1372,11 @@  discard block
 block discarded – undo
1372 1372
 
1373 1373
 		// Calculate
1374 1374
 		$principlePayment = ($principleRemaining * 1.0) / ($numberPeriods * 1.0);
1375
-		for($i=0; $i <= $period; ++$i) {
1375
+		for ($i = 0; $i <= $period; ++$i) {
1376 1376
 			$returnValue = $interestRate * $principleRemaining * -1;
1377 1377
 			$principleRemaining -= $principlePayment;
1378 1378
 			// principle needs to be 0 after the last payment, don't let floating point screw it up
1379
-			if($i == $numberPeriods) {
1379
+			if ($i == $numberPeriods) {
1380 1380
 				$returnValue = 0;
1381 1381
 			}
1382 1382
 		}
@@ -1385,17 +1385,17 @@  discard block
 block discarded – undo
1385 1385
 
1386 1386
 
1387 1387
 	public static function MIRR($values, $finance_rate, $reinvestment_rate) {
1388
-		if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
1389
-		$values				= PHPExcel_Calculation_Functions::flattenArray($values);
1390
-		$finance_rate		= PHPExcel_Calculation_Functions::flattenSingleValue($finance_rate);
1391
-		$reinvestment_rate	= PHPExcel_Calculation_Functions::flattenSingleValue($reinvestment_rate);
1388
+		if ( ! is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
1389
+		$values = PHPExcel_Calculation_Functions::flattenArray($values);
1390
+		$finance_rate = PHPExcel_Calculation_Functions::flattenSingleValue($finance_rate);
1391
+		$reinvestment_rate = PHPExcel_Calculation_Functions::flattenSingleValue($reinvestment_rate);
1392 1392
 		$n = count($values);
1393 1393
 
1394 1394
 		$rr = 1.0 + $reinvestment_rate;
1395 1395
 		$fr = 1.0 + $finance_rate;
1396 1396
 
1397 1397
 		$npv_pos = $npv_neg = 0.0;
1398
-		foreach($values as $i => $v) {
1398
+		foreach ($values as $i => $v) {
1399 1399
 			if ($v >= 0) {
1400 1400
 				$npv_pos += $v / pow($rr, $i);
1401 1401
 			} else {
@@ -1424,8 +1424,8 @@  discard block
 block discarded – undo
1424 1424
 	 * @return	float
1425 1425
 	 */
1426 1426
 	public static function NOMINAL($effect_rate = 0, $npery = 0) {
1427
-		$effect_rate	= PHPExcel_Calculation_Functions::flattenSingleValue($effect_rate);
1428
-		$npery			= (int)PHPExcel_Calculation_Functions::flattenSingleValue($npery);
1427
+		$effect_rate = PHPExcel_Calculation_Functions::flattenSingleValue($effect_rate);
1428
+		$npery = (int) PHPExcel_Calculation_Functions::flattenSingleValue($npery);
1429 1429
 
1430 1430
 		// Validate parameters
1431 1431
 		if ($effect_rate <= 0 || $npery < 1) {
@@ -1450,11 +1450,11 @@  discard block
 block discarded – undo
1450 1450
 	 * @return	float
1451 1451
 	 */
1452 1452
 	public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0) {
1453
-		$rate	= PHPExcel_Calculation_Functions::flattenSingleValue($rate);
1453
+		$rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
1454 1454
 		$pmt	= PHPExcel_Calculation_Functions::flattenSingleValue($pmt);
1455 1455
 		$pv		= PHPExcel_Calculation_Functions::flattenSingleValue($pv);
1456 1456
 		$fv		= PHPExcel_Calculation_Functions::flattenSingleValue($fv);
1457
-		$type	= PHPExcel_Calculation_Functions::flattenSingleValue($type);
1457
+		$type = PHPExcel_Calculation_Functions::flattenSingleValue($type);
1458 1458
 
1459 1459
 		// Validate parameters
1460 1460
 		if ($type != 0 && $type != 1) {
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
 		}
1463 1463
 
1464 1464
 		// Calculate
1465
-		if (!is_null($rate) && $rate != 0) {
1465
+		if ( ! is_null($rate) && $rate != 0) {
1466 1466
 			if ($pmt == 0 && $pv == 0) {
1467 1467
 				return PHPExcel_Calculation_Functions::NaN();
1468 1468
 			}
@@ -1471,7 +1471,7 @@  discard block
 block discarded – undo
1471 1471
 			if ($pmt == 0) {
1472 1472
 				return PHPExcel_Calculation_Functions::NaN();
1473 1473
 			}
1474
-			return (-$pv -$fv) / $pmt;
1474
+			return (-$pv - $fv) / $pmt;
1475 1475
 		}
1476 1476
 	}	//	function NPER()
1477 1477
 
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
 		}
1532 1532
 
1533 1533
 		// Calculate
1534
-		if (!is_null($rate) && $rate != 0) {
1534
+		if ( ! is_null($rate) && $rate != 0) {
1535 1535
 			return (-$fv - $pv * pow(1 + $rate, $nper)) / (1 + $rate * $type) / ((pow(1 + $rate, $nper) - 1) / $rate);
1536 1536
 		} else {
1537 1537
 			return (-$pv - $fv) / $nper;
@@ -1574,14 +1574,14 @@  discard block
 block discarded – undo
1574 1574
 	}	//	function PPMT()
1575 1575
 
1576 1576
 
1577
-	public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis=0) {
1578
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1579
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1580
-		$rate		= (float) PHPExcel_Calculation_Functions::flattenSingleValue($rate);
1577
+	public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis = 0) {
1578
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1579
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1580
+		$rate = (float) PHPExcel_Calculation_Functions::flattenSingleValue($rate);
1581 1581
 		$yield		= (float) PHPExcel_Calculation_Functions::flattenSingleValue($yield);
1582
-		$redemption	= (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
1583
-		$frequency	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
1584
-		$basis		= (is_null($basis))	? 0 :	(int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
1582
+		$redemption = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
1583
+		$frequency = (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
1584
+		$basis		= (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
1585 1585
 
1586 1586
 		if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
1587 1587
 			return PHPExcel_Calculation_Functions::VALUE();
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
 		}
1592 1592
 
1593 1593
 		if (($settlement > $maturity) ||
1594
-			(!self::_validFrequency($frequency)) ||
1594
+			( ! self::_validFrequency($frequency)) ||
1595 1595
 			(($basis < 0) || ($basis > 4))) {
1596 1596
 			return PHPExcel_Calculation_Functions::NaN();
1597 1597
 		}
@@ -1601,12 +1601,12 @@  discard block
 block discarded – undo
1601 1601
 		$n = self::COUPNUM($settlement, $maturity, $frequency, $basis);
1602 1602
 		$a = self::COUPDAYBS($settlement, $maturity, $frequency, $basis);
1603 1603
 
1604
-		$baseYF	= 1.0 + ($yield / $frequency);
1605
-		$rfp	= 100 * ($rate / $frequency);
1606
-		$de	= $dsc / $e;
1604
+		$baseYF = 1.0 + ($yield / $frequency);
1605
+		$rfp = 100 * ($rate / $frequency);
1606
+		$de = $dsc / $e;
1607 1607
 
1608 1608
 		$result = $redemption / pow($baseYF, (--$n + $de));
1609
-		for($k = 0; $k <= $n; ++$k) {
1609
+		for ($k = 0; $k <= $n; ++$k) {
1610 1610
 			$result += $rfp / (pow($baseYF, ($k + $de)));
1611 1611
 		}
1612 1612
 		$result -= $rfp * ($a / $e);
@@ -1634,12 +1634,12 @@  discard block
 block discarded – undo
1634 1634
 	 *										4				European 30/360
1635 1635
 	 * @return	float
1636 1636
 	 */
1637
-	public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis=0) {
1637
+	public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis = 0) {
1638 1638
 		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1639 1639
 		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1640 1640
 		$discount	= (float) PHPExcel_Calculation_Functions::flattenSingleValue($discount);
1641 1641
 		$redemption	= (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
1642
-		$basis		= (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
1642
+		$basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
1643 1643
 
1644 1644
 		//	Validate
1645 1645
 		if ((is_numeric($discount)) && (is_numeric($redemption)) && (is_numeric($basis))) {
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
 				return PHPExcel_Calculation_Functions::NaN();
1648 1648
 			}
1649 1649
 			$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
1650
-			if (!is_numeric($daysBetweenSettlementAndMaturity)) {
1650
+			if ( ! is_numeric($daysBetweenSettlementAndMaturity)) {
1651 1651
 				//	return date error
1652 1652
 				return $daysBetweenSettlementAndMaturity;
1653 1653
 			}
@@ -1678,11 +1678,11 @@  discard block
 block discarded – undo
1678 1678
 	 *										4				European 30/360
1679 1679
 	 * @return	float
1680 1680
 	 */
1681
-	public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis=0) {
1682
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1683
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1681
+	public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis = 0) {
1682
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1683
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1684 1684
 		$issue		= PHPExcel_Calculation_Functions::flattenSingleValue($issue);
1685
-		$rate		= PHPExcel_Calculation_Functions::flattenSingleValue($rate);
1685
+		$rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
1686 1686
 		$yield		= PHPExcel_Calculation_Functions::flattenSingleValue($yield);
1687 1687
 		$basis		= (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
1688 1688
 
@@ -1691,24 +1691,24 @@  discard block
 block discarded – undo
1691 1691
 			if (($rate <= 0) || ($yield <= 0)) {
1692 1692
 				return PHPExcel_Calculation_Functions::NaN();
1693 1693
 			}
1694
-			$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis);
1695
-			if (!is_numeric($daysPerYear)) {
1694
+			$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
1695
+			if ( ! is_numeric($daysPerYear)) {
1696 1696
 				return $daysPerYear;
1697 1697
 			}
1698 1698
 			$daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
1699
-			if (!is_numeric($daysBetweenIssueAndSettlement)) {
1699
+			if ( ! is_numeric($daysBetweenIssueAndSettlement)) {
1700 1700
 				//	return date error
1701 1701
 				return $daysBetweenIssueAndSettlement;
1702 1702
 			}
1703 1703
 			$daysBetweenIssueAndSettlement *= $daysPerYear;
1704 1704
 			$daysBetweenIssueAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $maturity, $basis);
1705
-			if (!is_numeric($daysBetweenIssueAndMaturity)) {
1705
+			if ( ! is_numeric($daysBetweenIssueAndMaturity)) {
1706 1706
 				//	return date error
1707 1707
 				return $daysBetweenIssueAndMaturity;
1708 1708
 			}
1709 1709
 			$daysBetweenIssueAndMaturity *= $daysPerYear;
1710 1710
 			$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
1711
-			if (!is_numeric($daysBetweenSettlementAndMaturity)) {
1711
+			if ( ! is_numeric($daysBetweenSettlementAndMaturity)) {
1712 1712
 				//	return date error
1713 1713
 				return $daysBetweenSettlementAndMaturity;
1714 1714
 			}
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
 		}
1748 1748
 
1749 1749
 		// Calculate
1750
-		if (!is_null($rate) && $rate != 0) {
1750
+		if ( ! is_null($rate) && $rate != 0) {
1751 1751
 			return (-$pmt * (1 + $rate * $type) * ((pow(1 + $rate, $nper) - 1) / $rate) - $fv) / pow(1 + $rate, $nper);
1752 1752
 		} else {
1753 1753
 			return -$fv - $pmt * $nper;
@@ -1786,12 +1786,12 @@  discard block
 block discarded – undo
1786 1786
 	 * @return	float
1787 1787
 	 **/
1788 1788
 	public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1) {
1789
-		$nper	= (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
1789
+		$nper = (int) PHPExcel_Calculation_Functions::flattenSingleValue($nper);
1790 1790
 		$pmt	= PHPExcel_Calculation_Functions::flattenSingleValue($pmt);
1791 1791
 		$pv		= PHPExcel_Calculation_Functions::flattenSingleValue($pv);
1792
-		$fv		= (is_null($fv))	? 0.0	:	PHPExcel_Calculation_Functions::flattenSingleValue($fv);
1793
-		$type	= (is_null($type))	? 0		:	(int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
1794
-		$guess	= (is_null($guess))	? 0.1	:	PHPExcel_Calculation_Functions::flattenSingleValue($guess);
1792
+		$fv		= (is_null($fv)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($fv);
1793
+		$type	= (is_null($type)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($type);
1794
+		$guess = (is_null($guess)) ? 0.1 : PHPExcel_Calculation_Functions::flattenSingleValue($guess);
1795 1795
 
1796 1796
 		$rate = $guess;
1797 1797
 		if (abs($rate) < FINANCIAL_PRECISION) {
@@ -1847,12 +1847,12 @@  discard block
 block discarded – undo
1847 1847
 	 *										4				European 30/360
1848 1848
 	 * @return	float
1849 1849
 	 */
1850
-	public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis=0) {
1850
+	public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis = 0) {
1851 1851
 		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1852 1852
 		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1853 1853
 		$investment	= (float) PHPExcel_Calculation_Functions::flattenSingleValue($investment);
1854 1854
 		$discount	= (float) PHPExcel_Calculation_Functions::flattenSingleValue($discount);
1855
-		$basis		= (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
1855
+		$basis = (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
1856 1856
 
1857 1857
 		//	Validate
1858 1858
 		if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) {
@@ -1860,12 +1860,12 @@  discard block
 block discarded – undo
1860 1860
 				return PHPExcel_Calculation_Functions::NaN();
1861 1861
 			}
1862 1862
 			$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
1863
-			if (!is_numeric($daysBetweenSettlementAndMaturity)) {
1863
+			if ( ! is_numeric($daysBetweenSettlementAndMaturity)) {
1864 1864
 				//	return date error
1865 1865
 				return $daysBetweenSettlementAndMaturity;
1866 1866
 			}
1867 1867
 
1868
-			return $investment / ( 1 - ($discount * $daysBetweenSettlementAndMaturity));
1868
+			return $investment / (1 - ($discount * $daysBetweenSettlementAndMaturity));
1869 1869
 		}
1870 1870
 		return PHPExcel_Calculation_Functions::VALUE();
1871 1871
 	}	//	function RECEIVED()
@@ -1883,7 +1883,7 @@  discard block
 block discarded – undo
1883 1883
 	 */
1884 1884
 	public static function SLN($cost, $salvage, $life) {
1885 1885
 		$cost		= PHPExcel_Calculation_Functions::flattenSingleValue($cost);
1886
-		$salvage	= PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
1886
+		$salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
1887 1887
 		$life		= PHPExcel_Calculation_Functions::flattenSingleValue($life);
1888 1888
 
1889 1889
 		// Calculate
@@ -1938,7 +1938,7 @@  discard block
 block discarded – undo
1938 1938
 	 * @return	float
1939 1939
 	 */
1940 1940
 	public static function TBILLEQ($settlement, $maturity, $discount) {
1941
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1941
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1942 1942
 		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1943 1943
 		$discount	= PHPExcel_Calculation_Functions::flattenSingleValue($discount);
1944 1944
 
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
 	 * @return	float
1977 1977
 	 */
1978 1978
 	public static function TBILLPRICE($settlement, $maturity, $discount) {
1979
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1979
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
1980 1980
 		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
1981 1981
 		$discount	= PHPExcel_Calculation_Functions::flattenSingleValue($discount);
1982 1982
 
@@ -1993,7 +1993,7 @@  discard block
 block discarded – undo
1993 1993
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
1994 1994
 				++$maturity;
1995 1995
 				$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
1996
-				if (!is_numeric($daysBetweenSettlementAndMaturity)) {
1996
+				if ( ! is_numeric($daysBetweenSettlementAndMaturity)) {
1997 1997
 					//	return date error
1998 1998
 					return $daysBetweenSettlementAndMaturity;
1999 1999
 				}
@@ -2028,9 +2028,9 @@  discard block
 block discarded – undo
2028 2028
 	 * @return	float
2029 2029
 	 */
2030 2030
 	public static function TBILLYIELD($settlement, $maturity, $price) {
2031
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
2032
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
2033
-		$price		= PHPExcel_Calculation_Functions::flattenSingleValue($price);
2031
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
2032
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
2033
+		$price = PHPExcel_Calculation_Functions::flattenSingleValue($price);
2034 2034
 
2035 2035
 		//	Validate
2036 2036
 		if (is_numeric($price)) {
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
2042 2042
 				++$maturity;
2043 2043
 				$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
2044
-				if (!is_numeric($daysBetweenSettlementAndMaturity)) {
2044
+				if ( ! is_numeric($daysBetweenSettlementAndMaturity)) {
2045 2045
 					//	return date error
2046 2046
 					return $daysBetweenSettlementAndMaturity;
2047 2047
 				}
@@ -2060,8 +2060,8 @@  discard block
 block discarded – undo
2060 2060
 
2061 2061
 
2062 2062
 	public static function XIRR($values, $dates, $guess = 0.1) {
2063
-		if ((!is_array($values)) && (!is_array($dates))) return PHPExcel_Calculation_Functions::VALUE();
2064
-		$values	= PHPExcel_Calculation_Functions::flattenArray($values);
2063
+		if (( ! is_array($values)) && ( ! is_array($dates))) return PHPExcel_Calculation_Functions::VALUE();
2064
+		$values = PHPExcel_Calculation_Functions::flattenArray($values);
2065 2065
 		$dates	= PHPExcel_Calculation_Functions::flattenArray($dates);
2066 2066
 		$guess = PHPExcel_Calculation_Functions::flattenSingleValue($guess);
2067 2067
 		if (count($values) != count($dates)) return PHPExcel_Calculation_Functions::NaN();
@@ -2090,7 +2090,7 @@  discard block
 block discarded – undo
2090 2090
 			$dx = $x1 - $x2;
2091 2091
 		}
2092 2092
 
2093
-		for ($i = 0;  $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
2093
+		for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
2094 2094
 			$dx *= 0.5;
2095 2095
 			$x_mid = $rtb + $dx;
2096 2096
 			$f_mid = self::XNPV($x_mid, $values, $dates);
@@ -2117,18 +2117,18 @@  discard block
 block discarded – undo
2117 2117
 	 */
2118 2118
 	public static function XNPV($rate, $values, $dates) {
2119 2119
 		$rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
2120
-		if (!is_numeric($rate)) return PHPExcel_Calculation_Functions::VALUE();
2121
-		if ((!is_array($values)) || (!is_array($dates))) return PHPExcel_Calculation_Functions::VALUE();
2122
-		$values	= PHPExcel_Calculation_Functions::flattenArray($values);
2123
-		$dates	= PHPExcel_Calculation_Functions::flattenArray($dates);
2120
+		if ( ! is_numeric($rate)) return PHPExcel_Calculation_Functions::VALUE();
2121
+		if (( ! is_array($values)) || ( ! is_array($dates))) return PHPExcel_Calculation_Functions::VALUE();
2122
+		$values = PHPExcel_Calculation_Functions::flattenArray($values);
2123
+		$dates = PHPExcel_Calculation_Functions::flattenArray($dates);
2124 2124
 		$valCount = count($values);
2125 2125
 		if ($valCount != count($dates)) return PHPExcel_Calculation_Functions::NaN();
2126 2126
 		if ((min($values) > 0) || (max($values) < 0)) return PHPExcel_Calculation_Functions::VALUE();
2127 2127
 
2128 2128
 		$xnpv = 0.0;
2129 2129
 		for ($i = 0; $i < $valCount; ++$i) {
2130
-			if (!is_numeric($values[$i])) return PHPExcel_Calculation_Functions::VALUE();
2131
-			$xnpv += $values[$i] / pow(1 + $rate, PHPExcel_Calculation_DateTime::DATEDIF($dates[0],$dates[$i],'d') / 365);
2130
+			if ( ! is_numeric($values[$i])) return PHPExcel_Calculation_Functions::VALUE();
2131
+			$xnpv += $values[$i] / pow(1 + $rate, PHPExcel_Calculation_DateTime::DATEDIF($dates[0], $dates[$i], 'd') / 365);
2132 2132
 		}
2133 2133
 		return (is_finite($xnpv)) ? $xnpv : PHPExcel_Calculation_Functions::VALUE();
2134 2134
 	}	//	function XNPV()
@@ -2153,9 +2153,9 @@  discard block
 block discarded – undo
2153 2153
 	 *										4				European 30/360
2154 2154
 	 * @return	float
2155 2155
 	 */
2156
-	public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis=0) {
2156
+	public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis = 0) {
2157 2157
 		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
2158
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
2158
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
2159 2159
 		$price		= PHPExcel_Calculation_Functions::flattenSingleValue($price);
2160 2160
 		$redemption	= PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
2161 2161
 		$basis		= (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
@@ -2165,12 +2165,12 @@  discard block
 block discarded – undo
2165 2165
 			if (($price <= 0) || ($redemption <= 0)) {
2166 2166
 				return PHPExcel_Calculation_Functions::NaN();
2167 2167
 			}
2168
-			$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis);
2169
-			if (!is_numeric($daysPerYear)) {
2168
+			$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
2169
+			if ( ! is_numeric($daysPerYear)) {
2170 2170
 				return $daysPerYear;
2171 2171
 			}
2172
-			$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity,$basis);
2173
-			if (!is_numeric($daysBetweenSettlementAndMaturity)) {
2172
+			$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
2173
+			if ( ! is_numeric($daysBetweenSettlementAndMaturity)) {
2174 2174
 				//	return date error
2175 2175
 				return $daysBetweenSettlementAndMaturity;
2176 2176
 			}
@@ -2202,11 +2202,11 @@  discard block
 block discarded – undo
2202 2202
 	 *										4				European 30/360
2203 2203
 	 * @return	float
2204 2204
 	 */
2205
-	public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis=0) {
2206
-		$settlement	= PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
2207
-		$maturity	= PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
2205
+	public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0) {
2206
+		$settlement = PHPExcel_Calculation_Functions::flattenSingleValue($settlement);
2207
+		$maturity = PHPExcel_Calculation_Functions::flattenSingleValue($maturity);
2208 2208
 		$issue		= PHPExcel_Calculation_Functions::flattenSingleValue($issue);
2209
-		$rate		= PHPExcel_Calculation_Functions::flattenSingleValue($rate);
2209
+		$rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
2210 2210
 		$price		= PHPExcel_Calculation_Functions::flattenSingleValue($price);
2211 2211
 		$basis		= (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
2212 2212
 
@@ -2215,24 +2215,24 @@  discard block
 block discarded – undo
2215 2215
 			if (($rate <= 0) || ($price <= 0)) {
2216 2216
 				return PHPExcel_Calculation_Functions::NaN();
2217 2217
 			}
2218
-			$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis);
2219
-			if (!is_numeric($daysPerYear)) {
2218
+			$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement), $basis);
2219
+			if ( ! is_numeric($daysPerYear)) {
2220 2220
 				return $daysPerYear;
2221 2221
 			}
2222 2222
 			$daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
2223
-			if (!is_numeric($daysBetweenIssueAndSettlement)) {
2223
+			if ( ! is_numeric($daysBetweenIssueAndSettlement)) {
2224 2224
 				//	return date error
2225 2225
 				return $daysBetweenIssueAndSettlement;
2226 2226
 			}
2227 2227
 			$daysBetweenIssueAndSettlement *= $daysPerYear;
2228 2228
 			$daysBetweenIssueAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $maturity, $basis);
2229
-			if (!is_numeric($daysBetweenIssueAndMaturity)) {
2229
+			if ( ! is_numeric($daysBetweenIssueAndMaturity)) {
2230 2230
 				//	return date error
2231 2231
 				return $daysBetweenIssueAndMaturity;
2232 2232
 			}
2233 2233
 			$daysBetweenIssueAndMaturity *= $daysPerYear;
2234 2234
 			$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
2235
-			if (!is_numeric($daysBetweenSettlementAndMaturity)) {
2235
+			if ( ! is_numeric($daysBetweenSettlementAndMaturity)) {
2236 2236
 				//	return date error
2237 2237
 				return $daysBetweenSettlementAndMaturity;
2238 2238
 			}
Please login to merge, or discard this patch.
Braces   +54 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1304,7 +1304,9 @@  discard block
 block discarded – undo
1304 1304
 
1305 1305
 
1306 1306
 	public static function IRR($values, $guess = 0.1) {
1307
-		if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
1307
+		if (!is_array($values)) {
1308
+			return PHPExcel_Calculation_Functions::VALUE();
1309
+		}
1308 1310
 		$values = PHPExcel_Calculation_Functions::flattenArray($values);
1309 1311
 		$guess = PHPExcel_Calculation_Functions::flattenSingleValue($guess);
1310 1312
 
@@ -1314,14 +1316,18 @@  discard block
 block discarded – undo
1314 1316
 		$f1 = self::NPV($x1, $values);
1315 1317
 		$f2 = self::NPV($x2, $values);
1316 1318
 		for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
1317
-			if (($f1 * $f2) < 0.0) break;
1319
+			if (($f1 * $f2) < 0.0) {
1320
+				break;
1321
+			}
1318 1322
 			if (abs($f1) < abs($f2)) {
1319 1323
 				$f1 = self::NPV($x1 += 1.6 * ($x1 - $x2), $values);
1320 1324
 			} else {
1321 1325
 				$f2 = self::NPV($x2 += 1.6 * ($x2 - $x1), $values);
1322 1326
 			}
1323 1327
 		}
1324
-		if (($f1 * $f2) > 0.0) return PHPExcel_Calculation_Functions::VALUE();
1328
+		if (($f1 * $f2) > 0.0) {
1329
+			return PHPExcel_Calculation_Functions::VALUE();
1330
+		}
1325 1331
 
1326 1332
 		$f = self::NPV($x1, $values);
1327 1333
 		if ($f < 0.0) {
@@ -1336,8 +1342,12 @@  discard block
 block discarded – undo
1336 1342
 			$dx *= 0.5;
1337 1343
 			$x_mid = $rtb + $dx;
1338 1344
 			$f_mid = self::NPV($x_mid, $values);
1339
-			if ($f_mid <= 0.0) $rtb = $x_mid;
1340
-			if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid;
1345
+			if ($f_mid <= 0.0) {
1346
+				$rtb = $x_mid;
1347
+			}
1348
+			if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) {
1349
+				return $x_mid;
1350
+			}
1341 1351
 		}
1342 1352
 		return PHPExcel_Calculation_Functions::VALUE();
1343 1353
 	}	//	function IRR()
@@ -1385,7 +1395,9 @@  discard block
 block discarded – undo
1385 1395
 
1386 1396
 
1387 1397
 	public static function MIRR($values, $finance_rate, $reinvestment_rate) {
1388
-		if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
1398
+		if (!is_array($values)) {
1399
+			return PHPExcel_Calculation_Functions::VALUE();
1400
+		}
1389 1401
 		$values				= PHPExcel_Calculation_Functions::flattenArray($values);
1390 1402
 		$finance_rate		= PHPExcel_Calculation_Functions::flattenSingleValue($finance_rate);
1391 1403
 		$reinvestment_rate	= PHPExcel_Calculation_Functions::flattenSingleValue($reinvestment_rate);
@@ -1810,8 +1822,9 @@  discard block
 block discarded – undo
1810 1822
 			$rate = ($y1 * $x0 - $y0 * $x1) / ($y1 - $y0);
1811 1823
 			$x0 = $x1;
1812 1824
 			$x1 = $rate;
1813
-			if (($nper * abs($pmt)) > ($pv - $fv))
1814
-				$x1 = abs($x1);
1825
+			if (($nper * abs($pmt)) > ($pv - $fv)) {
1826
+							$x1 = abs($x1);
1827
+			}
1815 1828
 
1816 1829
 			if (abs($rate) < FINANCIAL_PRECISION) {
1817 1830
 				$y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv;
@@ -2060,11 +2073,15 @@  discard block
 block discarded – undo
2060 2073
 
2061 2074
 
2062 2075
 	public static function XIRR($values, $dates, $guess = 0.1) {
2063
-		if ((!is_array($values)) && (!is_array($dates))) return PHPExcel_Calculation_Functions::VALUE();
2076
+		if ((!is_array($values)) && (!is_array($dates))) {
2077
+			return PHPExcel_Calculation_Functions::VALUE();
2078
+		}
2064 2079
 		$values	= PHPExcel_Calculation_Functions::flattenArray($values);
2065 2080
 		$dates	= PHPExcel_Calculation_Functions::flattenArray($dates);
2066 2081
 		$guess = PHPExcel_Calculation_Functions::flattenSingleValue($guess);
2067
-		if (count($values) != count($dates)) return PHPExcel_Calculation_Functions::NaN();
2082
+		if (count($values) != count($dates)) {
2083
+			return PHPExcel_Calculation_Functions::NaN();
2084
+		}
2068 2085
 
2069 2086
 		// create an initial range, with a root somewhere between 0 and guess
2070 2087
 		$x1 = 0.0;
@@ -2072,14 +2089,18 @@  discard block
 block discarded – undo
2072 2089
 		$f1 = self::XNPV($x1, $values, $dates);
2073 2090
 		$f2 = self::XNPV($x2, $values, $dates);
2074 2091
 		for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
2075
-			if (($f1 * $f2) < 0.0) break;
2092
+			if (($f1 * $f2) < 0.0) {
2093
+				break;
2094
+			}
2076 2095
 			if (abs($f1) < abs($f2)) {
2077 2096
 				$f1 = self::XNPV($x1 += 1.6 * ($x1 - $x2), $values, $dates);
2078 2097
 			} else {
2079 2098
 				$f2 = self::XNPV($x2 += 1.6 * ($x2 - $x1), $values, $dates);
2080 2099
 			}
2081 2100
 		}
2082
-		if (($f1 * $f2) > 0.0) return PHPExcel_Calculation_Functions::VALUE();
2101
+		if (($f1 * $f2) > 0.0) {
2102
+			return PHPExcel_Calculation_Functions::VALUE();
2103
+		}
2083 2104
 
2084 2105
 		$f = self::XNPV($x1, $values, $dates);
2085 2106
 		if ($f < 0.0) {
@@ -2094,8 +2115,12 @@  discard block
 block discarded – undo
2094 2115
 			$dx *= 0.5;
2095 2116
 			$x_mid = $rtb + $dx;
2096 2117
 			$f_mid = self::XNPV($x_mid, $values, $dates);
2097
-			if ($f_mid <= 0.0) $rtb = $x_mid;
2098
-			if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid;
2118
+			if ($f_mid <= 0.0) {
2119
+				$rtb = $x_mid;
2120
+			}
2121
+			if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) {
2122
+				return $x_mid;
2123
+			}
2099 2124
 		}
2100 2125
 		return PHPExcel_Calculation_Functions::VALUE();
2101 2126
 	}
@@ -2117,17 +2142,27 @@  discard block
 block discarded – undo
2117 2142
 	 */
2118 2143
 	public static function XNPV($rate, $values, $dates) {
2119 2144
 		$rate = PHPExcel_Calculation_Functions::flattenSingleValue($rate);
2120
-		if (!is_numeric($rate)) return PHPExcel_Calculation_Functions::VALUE();
2121
-		if ((!is_array($values)) || (!is_array($dates))) return PHPExcel_Calculation_Functions::VALUE();
2145
+		if (!is_numeric($rate)) {
2146
+			return PHPExcel_Calculation_Functions::VALUE();
2147
+		}
2148
+		if ((!is_array($values)) || (!is_array($dates))) {
2149
+			return PHPExcel_Calculation_Functions::VALUE();
2150
+		}
2122 2151
 		$values	= PHPExcel_Calculation_Functions::flattenArray($values);
2123 2152
 		$dates	= PHPExcel_Calculation_Functions::flattenArray($dates);
2124 2153
 		$valCount = count($values);
2125
-		if ($valCount != count($dates)) return PHPExcel_Calculation_Functions::NaN();
2126
-		if ((min($values) > 0) || (max($values) < 0)) return PHPExcel_Calculation_Functions::VALUE();
2154
+		if ($valCount != count($dates)) {
2155
+			return PHPExcel_Calculation_Functions::NaN();
2156
+		}
2157
+		if ((min($values) > 0) || (max($values) < 0)) {
2158
+			return PHPExcel_Calculation_Functions::VALUE();
2159
+		}
2127 2160
 
2128 2161
 		$xnpv = 0.0;
2129 2162
 		for ($i = 0; $i < $valCount; ++$i) {
2130
-			if (!is_numeric($values[$i])) return PHPExcel_Calculation_Functions::VALUE();
2163
+			if (!is_numeric($values[$i])) {
2164
+				return PHPExcel_Calculation_Functions::VALUE();
2165
+			}
2131 2166
 			$xnpv += $values[$i] / pow(1 + $rate, PHPExcel_Calculation_DateTime::DATEDIF($dates[0],$dates[$i],'d') / 365);
2132 2167
 		}
2133 2168
 		return (is_finite($xnpv)) ? $xnpv : PHPExcel_Calculation_Functions::VALUE();
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Calculation/FormulaParser.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      * Get Token
122 122
      *
123 123
      * @param 	int		$pId	Token id
124
-     * @return	string
124
+     * @return	PHPExcel_Calculation_FormulaToken
125 125
      * @throws  Exception
126 126
      */
127 127
     public function getToken($pId = 0) {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     /**
136 136
      * Get Token count
137 137
      *
138
-     * @return string
138
+     * @return integer
139 139
      */
140 140
     public function getTokenCount() {
141 141
     	return count($this->_tokens);
Please login to merge, or discard this patch.
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -89,71 +89,71 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	private $_tokens = array();
91 91
 
92
-    /**
93
-     * Create a new PHPExcel_Calculation_FormulaParser
94
-     *
95
-     * @param 	string		$pFormula	Formula to parse
96
-     * @throws 	Exception
97
-     */
98
-    public function __construct($pFormula = '')
99
-    {
100
-    	// Check parameters
101
-    	if (is_null($pFormula)) {
102
-    		throw new Exception("Invalid parameter passed: formula");
103
-    	}
104
-
105
-    	// Initialise values
106
-    	$this->_formula = trim($pFormula);
107
-    	// Parse!
108
-    	$this->_parseToTokens();
109
-    }
110
-
111
-    /**
112
-     * Get Formula
113
-     *
114
-     * @return string
115
-     */
116
-    public function getFormula() {
117
-    	return $this->_formula;
118
-    }
119
-
120
-    /**
121
-     * Get Token
122
-     *
123
-     * @param 	int		$pId	Token id
124
-     * @return	string
125
-     * @throws  Exception
126
-     */
127
-    public function getToken($pId = 0) {
128
-    	if (isset($this->_tokens[$pId])) {
129
-    		return $this->_tokens[$pId];
130
-    	} else {
131
-    		throw new Exception("Token with id $pId does not exist.");
132
-    	}
133
-    }
134
-
135
-    /**
136
-     * Get Token count
137
-     *
138
-     * @return string
139
-     */
140
-    public function getTokenCount() {
141
-    	return count($this->_tokens);
142
-    }
143
-
144
-    /**
145
-     * Get Tokens
146
-     *
147
-     * @return PHPExcel_Calculation_FormulaToken[]
148
-     */
149
-    public function getTokens() {
150
-    	return $this->_tokens;
151
-    }
152
-
153
-    /**
154
-     * Parse to tokens
155
-     */
156
-    private function _parseToTokens() {
92
+	/**
93
+	 * Create a new PHPExcel_Calculation_FormulaParser
94
+	 *
95
+	 * @param 	string		$pFormula	Formula to parse
96
+	 * @throws 	Exception
97
+	 */
98
+	public function __construct($pFormula = '')
99
+	{
100
+		// Check parameters
101
+		if (is_null($pFormula)) {
102
+			throw new Exception("Invalid parameter passed: formula");
103
+		}
104
+
105
+		// Initialise values
106
+		$this->_formula = trim($pFormula);
107
+		// Parse!
108
+		$this->_parseToTokens();
109
+	}
110
+
111
+	/**
112
+	 * Get Formula
113
+	 *
114
+	 * @return string
115
+	 */
116
+	public function getFormula() {
117
+		return $this->_formula;
118
+	}
119
+
120
+	/**
121
+	 * Get Token
122
+	 *
123
+	 * @param 	int		$pId	Token id
124
+	 * @return	string
125
+	 * @throws  Exception
126
+	 */
127
+	public function getToken($pId = 0) {
128
+		if (isset($this->_tokens[$pId])) {
129
+			return $this->_tokens[$pId];
130
+		} else {
131
+			throw new Exception("Token with id $pId does not exist.");
132
+		}
133
+	}
134
+
135
+	/**
136
+	 * Get Token count
137
+	 *
138
+	 * @return string
139
+	 */
140
+	public function getTokenCount() {
141
+		return count($this->_tokens);
142
+	}
143
+
144
+	/**
145
+	 * Get Tokens
146
+	 *
147
+	 * @return PHPExcel_Calculation_FormulaToken[]
148
+	 */
149
+	public function getTokens() {
150
+		return $this->_tokens;
151
+	}
152
+
153
+	/**
154
+	 * Parse to tokens
155
+	 */
156
+	private function _parseToTokens() {
157 157
 		// No attempt is made to verify formulas; assumes formulas are derived from Excel, where
158 158
 		// they can only exist if valid; stack overflows/underflows sunk as nulls without exceptions.
159 159
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 				continue;
454 454
 			}
455 455
 
456
-        	// token accumulation
456
+			// token accumulation
457 457
 			$value .= $this->_formula{$index};
458 458
 			++$index;
459 459
 		}
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 				}
609 609
 			}
610 610
 
611
-        	$this->_tokens[] = $token;
611
+			$this->_tokens[] = $token;
612 612
 		}
613
-    }
613
+	}
614 614
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	const COMMA         = ',';
72 72
 	const ERROR_START   = '#';
73 73
 
74
-	const OPERATORS_SN 			= "+-";
75
-	const OPERATORS_INFIX 		= "+-*/^&=><";
76
-	const OPERATORS_POSTFIX 	= "%";
74
+	const OPERATORS_SN = "+-";
75
+	const OPERATORS_INFIX = "+-*/^&=><";
76
+	const OPERATORS_POSTFIX = "%";
77 77
 
78 78
 	/**
79 79
 	 * Formula
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
 		if ($formulaLength < 2 || $this->_formula{0} != '=') return;
163 163
 
164 164
 		// Helper variables
165
-		$tokens1	= $tokens2 	= $stack = array();
166
-		$inString	= $inPath 	= $inRange 	= $inError = false;
167
-		$token		= $previousToken	= $nextToken	= null;
165
+		$tokens1 = $tokens2 	= $stack = array();
166
+		$inString = $inPath 	= $inRange = $inError = false;
167
+		$token = $previousToken = $nextToken = null;
168 168
 
169 169
 		$index	= 1;
170 170
 		$value	= '';
171 171
 
172
-		$ERRORS 			= array("#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A");
173
-		$COMPARATORS_MULTI 	= array(">=", "<=", "<>");
172
+		$ERRORS = array("#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A");
173
+		$COMPARATORS_MULTI = array(">=", "<=", "<>");
174 174
 
175 175
 		while ($index < $formulaLength) {
176 176
 			// state-dependent character evaluation (order is important)
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 			// standard infix operators
382 382
 			if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->_formula{$index}) !== false) {
383 383
 				if (strlen($value) > 0) {
384
-					$tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
384
+					$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
385 385
 					$value = "";
386 386
 				}
387 387
 				$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->_formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX);
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
 				continue;
492 492
 			}
493 493
 
494
-			if (! (
494
+			if ( ! (
495 495
 					(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
496 496
 					(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
497 497
 					($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
498
-				  ) ) {
498
+				  )) {
499 499
 				continue;
500 500
 			}
501 501
 
@@ -503,11 +503,11 @@  discard block
 block discarded – undo
503 503
 				continue;
504 504
 			}
505 505
 
506
-			if (! (
506
+			if ( ! (
507 507
 					(($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
508 508
 					(($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
509 509
 					($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
510
-				  ) ) {
510
+				  )) {
511 511
 				continue;
512 512
 			}
513 513
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 			}
587 587
 
588 588
 			if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND && $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
589
-				if (!is_numeric($token->getValue())) {
589
+				if ( ! is_numeric($token->getValue())) {
590 590
 					if (strtoupper($token->getValue()) == "TRUE" || strtoupper($token->getValue() == "FALSE")) {
591 591
 						$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
592 592
 					} else {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -159,7 +159,9 @@
 block discarded – undo
159 159
 
160 160
 		// Check if the formula has a valid starting =
161 161
 		$formulaLength = strlen($this->_formula);
162
-		if ($formulaLength < 2 || $this->_formula{0} != '=') return;
162
+		if ($formulaLength < 2 || $this->_formula{0} != '=') {
163
+			return;
164
+		}
163 165
 
164 166
 		// Helper variables
165 167
 		$tokens1	= $tokens2 	= $stack = array();
Please login to merge, or discard this patch.