From 550907fc778e5c0260b0cbc9d03ce2ac494eebf9 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Mon, 25 May 2015 22:48:27 +0100 Subject: [PATCH] More namespace work on PHPExcel core --- classes/src/CachedObjectStorage/APC.php | 14 +-- classes/src/CachedObjectStorage/DiscISAM.php | 12 +- classes/src/CachedObjectStorage/ICache.php | 10 +- classes/src/CachedObjectStorage/Memcache.php | 42 ++++--- classes/src/CachedObjectStorage/Memory.php | 6 +- .../src/CachedObjectStorage/MemoryGZip.php | 10 +- .../CachedObjectStorage/MemorySerialized.php | 10 +- classes/src/CachedObjectStorage/PHPTemp.php | 12 +- classes/src/CachedObjectStorage/SQLite.php | 35 +++--- classes/src/CachedObjectStorage/SQLite3.php | 40 +++--- classes/src/CachedObjectStorage/Wincache.php | 34 +++--- classes/src/CachedObjectStorageFactory.php | 2 +- classes/src/CalcEngine/Logger.php | 4 +- classes/src/Calculation/Categories.php | 13 +- classes/src/Calculation/Database.php | 32 ++--- classes/src/Calculation/DateTime.php | 114 +++++++++--------- 16 files changed, 202 insertions(+), 188 deletions(-) diff --git a/classes/src/CachedObjectStorage/APC.php b/classes/src/CachedObjectStorage/APC.php index b354adda..b0e4c591 100644 --- a/classes/src/CachedObjectStorage/APC.php +++ b/classes/src/CachedObjectStorage/APC.php @@ -94,7 +94,7 @@ class APC extends CacheBase implements ICache } /** - * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? + * Is a value set in the current \PHPExcel\CachedObjectStorage\ICache for an indexed cell? * * @access public * @param string $pCoord Coordinate address of the cell to check @@ -125,8 +125,8 @@ class APC extends CacheBase implements ICache * * @access public * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws \PHPExcel\Exception + * @return \PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -141,7 +141,7 @@ class APC extends CacheBase implements ICache if ($obj === false) { // Entry no longer exists in APC, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); + throw new \PHPExcel\Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); } } else { // Return null if requested entry doesn't exist in cache @@ -177,7 +177,7 @@ class APC extends CacheBase implements ICache * * @access public * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @throws \PHPExcel\Exception */ public function deleteCacheData($pCoord) { @@ -243,10 +243,10 @@ class APC extends CacheBase implements ICache /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param \PHPExcel\Worksheet $parent The worksheet for this cell collection * @param array of mixed $arguments Additional initialisation arguments */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) + public function __construct(\PHPExcel\Worksheet $parent, $arguments) { $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; diff --git a/classes/src/CachedObjectStorage/DiscISAM.php b/classes/src/CachedObjectStorage/DiscISAM.php index 1aa6b176..603f1705 100644 --- a/classes/src/CachedObjectStorage/DiscISAM.php +++ b/classes/src/CachedObjectStorage/DiscISAM.php @@ -55,7 +55,7 @@ class DiscISAM extends CacheBase implements ICache * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws \PHPExcel\Exception */ protected function storeData() { @@ -98,8 +98,8 @@ class DiscISAM extends CacheBase implements ICache * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @throws \PHPExcel\Exception + * @return \PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -179,14 +179,14 @@ class DiscISAM extends CacheBase implements ICache /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param \PHPExcel\Worksheet $parent The worksheet for this cell collection * @param array of mixed $arguments Additional initialisation arguments */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) + public function __construct(\PHPExcel\Worksheet $parent, $arguments) { $this->cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null)) ? $arguments['dir'] - : PHPExcel_Shared_File::sys_get_temp_dir(); + : \PHPExcel\Shared\File::sys_get_temp_dir(); parent::__construct($parent); if (is_null($this->fileHandle)) { diff --git a/classes/src/CachedObjectStorage/ICache.php b/classes/src/CachedObjectStorage/ICache.php index 56d6226d..f2e21631 100644 --- a/classes/src/CachedObjectStorage/ICache.php +++ b/classes/src/CachedObjectStorage/ICache.php @@ -51,9 +51,9 @@ interface ICache /** * Fetch a cell from cache identified by coordinate address * - * @param string $pCoord Coordinate address of the cell to retrieve - * @return PHPExcel_Cell Cell that was found, or null if not found - * @throws PHPExcel_Exception + * @param string $pCoord Coordinate address of the cell to retrieve + * @return \PHPExcel\Cell Cell that was found, or null if not found + * @throws \PHPExcel\Exception */ public function getCacheData($pCoord); @@ -61,12 +61,12 @@ interface ICache * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @throws \PHPExcel\Exception */ public function deleteCacheData($pCoord); /** - * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? + * Is a value set in the current \PHPExcel\CachedObjectStorage\ICache for an indexed cell? * * @param string $pCoord Coordinate address of the cell to check * @return boolean diff --git a/classes/src/CachedObjectStorage/Memcache.php b/classes/src/CachedObjectStorage/Memcache.php index 1720803a..a2da4b05 100644 --- a/classes/src/CachedObjectStorage/Memcache.php +++ b/classes/src/CachedObjectStorage/Memcache.php @@ -99,11 +99,11 @@ class Memcache extends CacheBase implements ICache /** - * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? + * Is a value set in the current \PHPExcel\CachedObjectStorage\ICache for an indexed cell? * * @param string $pCoord Coordinate address of the cell to check - * @return boolean - * @return boolean + * @return boolean + * @throws \PHPExcel\Exception */ public function isDataSet($pCoord) { @@ -117,7 +117,7 @@ class Memcache extends CacheBase implements ICache if ($success === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); + throw new \PHPExcel\Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); } return true; } @@ -128,9 +128,9 @@ class Memcache extends CacheBase implements ICache /** * Get cell at a specific coordinate * - * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @param string $pCoord Coordinate of the cell + * @throws \PHPExcel\Exception + * @return \PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -145,7 +145,7 @@ class Memcache extends CacheBase implements ICache if ($obj === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception("Cell entry {$pCoord} no longer exists in MemCache"); + throw new \PHPExcel\Exception("Cell entry {$pCoord} no longer exists in MemCache"); } } else { // Return null if requested entry doesn't exist in cache @@ -179,8 +179,8 @@ class Memcache extends CacheBase implements ICache /** * Delete a cell in cache identified by coordinate address * - * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @param string $pCoord Coordinate address of the cell to delete + * @throws \PHPExcel\Exception */ public function deleteCacheData($pCoord) { @@ -195,6 +195,7 @@ class Memcache extends CacheBase implements ICache * Clone the cell collection * * @param \PHPExcel\Worksheet $parent The new worksheet that we're copying to + * @throws \PHPExcel\Exception */ public function copyCellCollection(\PHPExcel\Worksheet $parent) { @@ -209,11 +210,11 @@ class Memcache extends CacheBase implements ICache if ($obj === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($cellID); - throw new PHPExcel_Exception("Cell entry {$cellID} no longer exists in MemCache"); + throw new \PHPExcel\Exception("Cell entry {$cellID} no longer exists in MemCache"); } if (!$this->memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception("Failed to store cell {$cellID} in MemCache"); + throw new \PHPExcel\Exception("Failed to store cell {$cellID} in MemCache"); } } } @@ -244,10 +245,11 @@ class Memcache extends CacheBase implements ICache /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection - * @param array of mixed $arguments Additional initialisation arguments + * @param \PHPExcel\Worksheet $parent The worksheet for this cell collection + * @param mixed[] $arguments Additional initialisation arguments + * @throws \PHPExcel\Exception */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) + public function __construct(\PHPExcel\Worksheet $parent, $arguments) { $memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost'; $memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211; @@ -260,7 +262,7 @@ class Memcache extends CacheBase implements ICache // Set a new Memcache object and connect to the Memcache server $this->memcache = new Memcache(); if (!$this->memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) { - throw new PHPExcel_Exception("Could not connect to MemCache server at {$memcacheServer}:{$memcachePort}"); + throw new \PHPExcel\Exception("Could not connect to MemCache server at {$memcacheServer}:{$memcachePort}"); } $this->cacheTime = $cacheTime; @@ -271,13 +273,13 @@ class Memcache extends CacheBase implements ICache /** * Memcache error handler * - * @param string $host Memcache server - * @param integer $port Memcache port - * @throws PHPExcel_Exception + * @param string $host Memcache server + * @param integer $port Memcache port + * @throws \PHPExcel\Exception */ public function failureCallback($host, $port) { - throw new PHPExcel_Exception("memcache {$host}:{$port} failed"); + throw new \PHPExcel\Exception("memcache {$host}:{$port} failed"); } /** diff --git a/classes/src/CachedObjectStorage/Memory.php b/classes/src/CachedObjectStorage/Memory.php index 865a7f1f..f5c3dfa6 100644 --- a/classes/src/CachedObjectStorage/Memory.php +++ b/classes/src/CachedObjectStorage/Memory.php @@ -60,9 +60,9 @@ class Memory extends CacheBase implements ICache /** * Get cell at a specific coordinate * - * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @param string $pCoord Coordinate of the cell + * @throws \PHPExcel\Exception + * @return \PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { diff --git a/classes/src/CachedObjectStorage/MemoryGZip.php b/classes/src/CachedObjectStorage/MemoryGZip.php index 76c28fbd..48c8220b 100644 --- a/classes/src/CachedObjectStorage/MemoryGZip.php +++ b/classes/src/CachedObjectStorage/MemoryGZip.php @@ -33,8 +33,8 @@ class MemoryGZip extends CacheBase implements ICache * Store cell data in cache for the current cell object if it's "dirty", * and the 'nullify' the current cell object * - * @return void - * @throws PHPExcel_Exception + * @return void + * @throws \PHPExcel\Exception */ protected function storeData() { @@ -73,9 +73,9 @@ class MemoryGZip extends CacheBase implements ICache /** * Get cell at a specific coordinate * - * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @param string $pCoord Coordinate of the cell + * @throws \PHPExcel\Exception + * @return \PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { diff --git a/classes/src/CachedObjectStorage/MemorySerialized.php b/classes/src/CachedObjectStorage/MemorySerialized.php index aefad66b..c4198a7b 100644 --- a/classes/src/CachedObjectStorage/MemorySerialized.php +++ b/classes/src/CachedObjectStorage/MemorySerialized.php @@ -33,8 +33,8 @@ class MemorySerialized extends CacheBase implements ICache * Store cell data in cache for the current cell object if it's "dirty", * and the 'nullify' the current cell object * - * @return void - * @throws PHPExcel_Exception + * @return void + * @throws \PHPExcel\Exception */ protected function storeData() { @@ -71,9 +71,9 @@ class MemorySerialized extends CacheBase implements ICache /** * Get cell at a specific coordinate * - * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @param string $pCoord Coordinate of the cell + * @throws \PHPExcel\Exception + * @return \PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { diff --git a/classes/src/CachedObjectStorage/PHPTemp.php b/classes/src/CachedObjectStorage/PHPTemp.php index ed32935b..faef75d7 100644 --- a/classes/src/CachedObjectStorage/PHPTemp.php +++ b/classes/src/CachedObjectStorage/PHPTemp.php @@ -91,9 +91,9 @@ class PHPTemp extends CacheBase implements ICache /** * Get cell at a specific coordinate * - * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @param string $pCoord Coordinate of the cell + * @throws \PHPExcel\Exception + * @return \PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -174,10 +174,10 @@ class PHPTemp extends CacheBase implements ICache /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection - * @param array of mixed $arguments Additional initialisation arguments + * @param \PHPExcel\Worksheet $parent The worksheet for this cell collection + * @param mixed[] $arguments Additional initialisation arguments */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) + public function __construct(\PHPExcel\Worksheet $parent, $arguments) { $this->memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB'; diff --git a/classes/src/CachedObjectStorage/SQLite.php b/classes/src/CachedObjectStorage/SQLite.php index 891f76b5..31371dd4 100644 --- a/classes/src/CachedObjectStorage/SQLite.php +++ b/classes/src/CachedObjectStorage/SQLite.php @@ -100,7 +100,7 @@ class SQLite extends CacheBase implements ICache $query = "SELECT value FROM kvp_".$this->TableName." WHERE id='".$pCoord."'"; $cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC); if ($cellResultSet === false) { - throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError())); + throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); } elseif ($cellResultSet->numRows() == 0) { // Return null if requested entry doesn't exist in cache return null; @@ -121,8 +121,9 @@ class SQLite extends CacheBase implements ICache /** * Is a value set for an indexed cell? * - * @param string $pCoord Coordinate address of the cell to check - * @return boolean + * @param string $pCoord Coordinate address of the cell to check + * @return boolean + * @throws \PHPExcel\Exception */ public function isDataSet($pCoord) { @@ -134,7 +135,7 @@ class SQLite extends CacheBase implements ICache $query = "SELECT id FROM kvp_".$this->TableName." WHERE id='".$pCoord."'"; $cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC); if ($cellResultSet === false) { - throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError())); + throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); } elseif ($cellResultSet->numRows() == 0) { // Return null if requested entry doesn't exist in cache return false; @@ -145,8 +146,8 @@ class SQLite extends CacheBase implements ICache /** * Delete a cell in cache identified by coordinate address * - * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @param string $pCoord Coordinate address of the cell to delete + * @throws \PHPExcel\Exception */ public function deleteCacheData($pCoord) { @@ -158,7 +159,7 @@ class SQLite extends CacheBase implements ICache // Check if the requested entry exists in the cache $query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$pCoord."'"; if (!$this->DBHandle->queryExec($query)) { - throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError())); + throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); } $this->currentCellIsDirty = false; @@ -169,6 +170,7 @@ class SQLite extends CacheBase implements ICache * * @param string $fromAddress Current address of the cell to move * @param string $toAddress Destination address of the cell to move + * @throws \PHPExcel\Exception * @return boolean */ public function moveCell($fromAddress, $toAddress) @@ -180,13 +182,13 @@ class SQLite extends CacheBase implements ICache $query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$toAddress."'"; $result = $this->DBHandle->exec($query); if ($result === false) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } $query = "UPDATE kvp_".$this->TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'"; $result = $this->DBHandle->exec($query); if ($result === false) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } return true; @@ -196,6 +198,7 @@ class SQLite extends CacheBase implements ICache * Get a list of all cell addresses currently held in cache * * @return string[] + * @throws \PHPExcel\Exception */ public function getCellList() { @@ -206,7 +209,7 @@ class SQLite extends CacheBase implements ICache $query = "SELECT id FROM kvp_".$this->TableName; $cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC); if ($cellIdsResult === false) { - throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError())); + throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); } $cellKeys = array(); @@ -221,6 +224,7 @@ class SQLite extends CacheBase implements ICache * Clone the cell collection * * @param \PHPExcel\Worksheet $parent The new worksheet that we're copying to + * @throws \PHPExcel\Exception */ public function copyCellCollection(\PHPExcel\Worksheet $parent) { @@ -232,7 +236,7 @@ class SQLite extends CacheBase implements ICache if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) AS SELECT * FROM kvp_'.$this->TableName) ) { - throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError())); + throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); } // Copy the existing cell cache file @@ -260,9 +264,10 @@ class SQLite extends CacheBase implements ICache /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param \PHPExcel\Worksheet $parent The worksheet for this cell collection + * @throws \PHPExcel\Exception */ - public function __construct(PHPExcel_Worksheet $parent) + public function __construct(\PHPExcel\Worksheet $parent) { parent::__construct($parent); if (is_null($this->DBHandle)) { @@ -271,10 +276,10 @@ class SQLite extends CacheBase implements ICache $this->DBHandle = new SQLiteDatabase($_DBName); if ($this->DBHandle === false) { - throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError())); + throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); } if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { - throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError())); + throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); } } } diff --git a/classes/src/CachedObjectStorage/SQLite3.php b/classes/src/CachedObjectStorage/SQLite3.php index 739e0da4..f6c4c0e2 100644 --- a/classes/src/CachedObjectStorage/SQLite3.php +++ b/classes/src/CachedObjectStorage/SQLite3.php @@ -101,7 +101,7 @@ class SQLite3 extends CacheBase implements ICache * @return \PHPExcel\Cell * @throws \PHPExcel\Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) + public function addCacheData($pCoord, \PHPExcel\Cell $cell) { if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) { $this->storeData(); @@ -117,9 +117,10 @@ class SQLite3 extends CacheBase implements ICache /** * Get cell at a specific coordinate * - * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @param string $pCoord Coordinate of the cell + * @throws \PHPExcel\Exception + * @return \PHPExcel\Cell Cell that was found, or null if not found + * @throws \PHPExcel\Exception */ public function getCacheData($pCoord) { @@ -131,7 +132,7 @@ class SQLite3 extends CacheBase implements ICache $this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT); $cellResult = $this->selectQuery->execute(); if ($cellResult === false) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } $cellData = $cellResult->fetchArray(SQLITE3_ASSOC); if ($cellData === false) { @@ -155,6 +156,7 @@ class SQLite3 extends CacheBase implements ICache * * @param string $pCoord Coordinate address of the cell to check * @return boolean + * @throws \PHPExcel\Exception */ public function isDataSet($pCoord) { @@ -166,7 +168,7 @@ class SQLite3 extends CacheBase implements ICache $this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT); $cellResult = $this->selectQuery->execute(); if ($cellResult === false) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } $cellData = $cellResult->fetchArray(SQLITE3_ASSOC); @@ -176,8 +178,8 @@ class SQLite3 extends CacheBase implements ICache /** * Delete a cell in cache identified by coordinate address * - * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @param string $pCoord Coordinate address of the cell to delete + * @throws \PHPExcel\Exception */ public function deleteCacheData($pCoord) { @@ -190,7 +192,7 @@ class SQLite3 extends CacheBase implements ICache $this->deleteQuery->bindValue('id', $pCoord, SQLITE3_TEXT); $result = $this->deleteQuery->execute(); if ($result === false) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } $this->currentCellIsDirty = false; @@ -202,6 +204,7 @@ class SQLite3 extends CacheBase implements ICache * @param string $fromAddress Current address of the cell to move * @param string $toAddress Destination address of the cell to move * @return boolean + * @throws \PHPExcel\Exception */ public function moveCell($fromAddress, $toAddress) { @@ -212,14 +215,14 @@ class SQLite3 extends CacheBase implements ICache $this->deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT); $result = $this->deleteQuery->execute(); if ($result === false) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } $this->updateQuery->bindValue('toid', $toAddress, SQLITE3_TEXT); $this->updateQuery->bindValue('fromid', $fromAddress, SQLITE3_TEXT); $result = $this->updateQuery->execute(); if ($result === false) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } return true; @@ -229,6 +232,7 @@ class SQLite3 extends CacheBase implements ICache * Get a list of all cell addresses currently held in cache * * @return string[] + * @throws \PHPExcel\Exception */ public function getCellList() { @@ -239,7 +243,7 @@ class SQLite3 extends CacheBase implements ICache $query = "SELECT id FROM kvp_".$this->TableName; $cellIdsResult = $this->DBHandle->query($query); if ($cellIdsResult === false) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } $cellKeys = array(); @@ -254,6 +258,7 @@ class SQLite3 extends CacheBase implements ICache * Clone the cell collection * * @param \PHPExcel\Worksheet $parent The new worksheet that we're copying to + * @throws \PHPExcel\Exception */ public function copyCellCollection(\PHPExcel\Worksheet $parent) { @@ -265,7 +270,7 @@ class SQLite3 extends CacheBase implements ICache if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) AS SELECT * FROM kvp_'.$this->TableName) ) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } // Copy the existing cell cache file @@ -293,9 +298,10 @@ class SQLite3 extends CacheBase implements ICache /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param \PHPExcel\Worksheet $parent The worksheet for this cell collection + * @throws \PHPExcel\Exception */ - public function __construct(PHPExcel_Worksheet $parent) + public function __construct(\PHPExcel\Worksheet $parent) { parent::__construct($parent); if (is_null($this->DBHandle)) { @@ -304,10 +310,10 @@ class SQLite3 extends CacheBase implements ICache $this->DBHandle = new SQLite3($_DBName); if ($this->DBHandle === false) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { - throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg()); + throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); } } diff --git a/classes/src/CachedObjectStorage/Wincache.php b/classes/src/CachedObjectStorage/Wincache.php index bcf6fa08..44e03d6b 100644 --- a/classes/src/CachedObjectStorage/Wincache.php +++ b/classes/src/CachedObjectStorage/Wincache.php @@ -49,7 +49,7 @@ class Wincache extends CacheBase implements ICache * and the 'nullify' the current cell object * * @return void - * @throws PHPExcel_Exception + * @throws \PHPExcel\Exception */ protected function storeData() { @@ -60,12 +60,12 @@ class Wincache extends CacheBase implements ICache if (wincache_ucache_exists($this->cachePrefix.$this->currentObjectID.'.cache')) { if (!wincache_ucache_set($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache'); + throw new \PHPExcel\Exception('Failed to store cell '.$this->currentObjectID.' in WinCache'); } } else { if (!wincache_ucache_add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache'); + throw new \PHPExcel\Exception('Failed to store cell '.$this->currentObjectID.' in WinCache'); } } $this->currentCellIsDirty = false; @@ -97,10 +97,11 @@ class Wincache extends CacheBase implements ICache } /** - * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? + * Is a value set in the current \PHPExcel\CachedObjectStorage\ICache for an indexed cell? * * @param string $pCoord Coordinate address of the cell to check * @return boolean + * @throws \PHPExcel\Exception */ public function isDataSet($pCoord) { @@ -114,7 +115,7 @@ class Wincache extends CacheBase implements ICache if ($success === false) { // Entry no longer exists in Wincache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); + throw new \PHPExcel\Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); } return true; } @@ -125,9 +126,9 @@ class Wincache extends CacheBase implements ICache /** * Get cell at a specific coordinate * - * @param string $pCoord Coordinate of the cell - * @throws PHPExcel_Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @param string $pCoord Coordinate of the cell + * @throws \PHPExcel\Exception + * @return \PHPExcel\Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -144,7 +145,7 @@ class Wincache extends CacheBase implements ICache if ($success === false) { // Entry no longer exists in WinCache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); + throw new \PHPExcel\Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); } } else { // Return null if requested entry doesn't exist in cache @@ -179,8 +180,8 @@ class Wincache extends CacheBase implements ICache /** * Delete a cell in cache identified by coordinate address * - * @param string $pCoord Coordinate address of the cell to delete - * @throws PHPExcel_Exception + * @param string $pCoord Coordinate address of the cell to delete + * @throws \PHPExcel\Exception */ public function deleteCacheData($pCoord) { @@ -195,6 +196,7 @@ class Wincache extends CacheBase implements ICache * Clone the cell collection * * @param \PHPExcel\Worksheet $parent The new worksheet that we're copying to + * @throws \PHPExcel\Exception */ public function copyCellCollection(\PHPExcel\Worksheet $parent) { @@ -210,11 +212,11 @@ class Wincache extends CacheBase implements ICache if ($success === false) { // Entry no longer exists in WinCache, so clear it from the cache array parent::deleteCacheData($cellID); - throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache'); + throw new \PHPExcel\Exception('Cell entry '.$cellID.' no longer exists in Wincache'); } if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->cacheTime)) { $this->__destruct(); - throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache'); + throw new \PHPExcel\Exception('Failed to store cell '.$cellID.' in Wincache'); } } } @@ -246,10 +248,10 @@ class Wincache extends CacheBase implements ICache /** * Initialise this new cell collection * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection - * @param array of mixed $arguments Additional initialisation arguments + * @param \PHPExcel\Worksheet $parent The worksheet for this cell collection + * @param mixed[] $arguments Additional initialisation arguments */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) + public function __construct(\PHPExcel\Worksheet $parent, $arguments) { $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; diff --git a/classes/src/CachedObjectStorageFactory.php b/classes/src/CachedObjectStorageFactory.php index 219c1944..591af72b 100644 --- a/classes/src/CachedObjectStorageFactory.php +++ b/classes/src/CachedObjectStorageFactory.php @@ -152,7 +152,7 @@ class CachedObjectStorageFactory { $activeMethods = array(); foreach (self::$storageMethods as $storageMethod) { - $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod; + $cacheStorageClass = '\\PHPExcel\\CachedObjectStorage\\' . $storageMethod; if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) { $activeMethods[] = $storageMethod; } diff --git a/classes/src/CalcEngine/Logger.php b/classes/src/CalcEngine/Logger.php index 8ca7915d..21d097ab 100644 --- a/classes/src/CalcEngine/Logger.php +++ b/classes/src/CalcEngine/Logger.php @@ -58,14 +58,14 @@ class Logger /** * The calculation engine cell reference stack * - * @var PHPExcel_CalcEngine_CyclicReferenceStack + * @var CyclicReferenceStack */ private $cellStack; /** * Instantiate a Calculation engine logger * - * @param PHPExcel_CalcEngine_CyclicReferenceStack $stack + * @param CyclicReferenceStack $stack */ public function __construct(CyclicReferenceStack $stack) { diff --git a/classes/src/Calculation/Categories.php b/classes/src/Calculation/Categories.php index 19e6069f..57766207 100644 --- a/classes/src/Calculation/Categories.php +++ b/classes/src/Calculation/Categories.php @@ -64,12 +64,11 @@ class Categories private $phpExcelName; /** - * Create a new PHPExcel_Calculation_Function - * + * Create a new Categories * @param string $pCategory Category (represented by CATEGORY_*) * @param string $pExcelName Excel function name * @param string $pPHPExcelName PHPExcel function mapping - * @throws PHPExcel_Calculation_Exception + * @throws Exception */ public function __construct($pCategory = null, $pExcelName = null, $pPHPExcelName = null) { @@ -79,7 +78,7 @@ class Categories $this->excelName = $pExcelName; $this->phpExcelName = $pPHPExcelName; } else { - throw new PHPExcel_Calculation_Exception("Invalid parameters passed."); + throw new Exception("Invalid parameters passed."); } } @@ -96,15 +95,15 @@ class Categories /** * Set Category (represented by CATEGORY_*) * - * @param string $value - * @throws PHPExcel_Calculation_Exception + * @param string $value + * @throws Exception */ public function setCategory($value = null) { if (!is_null($value)) { $this->category = $value; } else { - throw new PHPExcel_Calculation_Exception("Invalid parameter passed."); + throw new Exception("Invalid parameter passed."); } } diff --git a/classes/src/Calculation/Database.php b/classes/src/Calculation/Database.php index 0ac2370d..5f94a21d 100644 --- a/classes/src/Calculation/Database.php +++ b/classes/src/Calculation/Database.php @@ -49,7 +49,7 @@ class Database */ private static function fieldExtract($database, $field) { - $field = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($field)); + $field = strtoupper(Functions::flattenSingleValue($field)); $fieldNames = array_map('strtoupper', array_shift($database)); if (is_numeric($field)) { @@ -92,7 +92,7 @@ class Database $testConditionCount = 0; foreach ($criteria as $row => $criterion) { if ($criterion[$key] > '') { - $testCondition[] = '[:'.$criteriaName.']'.PHPExcel_Calculation_Functions::ifCondition($criterion[$key]); + $testCondition[] = '[:'.$criteriaName.']'.Functions::ifCondition($criterion[$key]); $testConditionCount++; } } @@ -119,12 +119,12 @@ class Database $k = array_search($criteriaName, $fieldNames); if (isset($dataValues[$k])) { $dataValue = $dataValues[$k]; - $dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::wrapResult(strtoupper($dataValue)) : $dataValue; + $dataValue = (is_string($dataValue)) ? \PHPExcel\Calculation::wrapResult(strtoupper($dataValue)) : $dataValue; $testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList); } } // evaluate the criteria against the row data - $result = PHPExcel_Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList); + $result = \PHPExcel\Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList); // If the row failed to meet the criteria, remove it from the database if (!$result) { unset($database[$dataRow]); @@ -183,7 +183,7 @@ class Database } // Return - return PHPExcel_Calculation_Statistical::AVERAGE( + return Statistical::AVERAGE( self::getFilteredColumn($database, $field, $criteria) ); } @@ -231,7 +231,7 @@ class Database } // Return - return PHPExcel_Calculation_Statistical::COUNT( + return Statistical::COUNT( self::getFilteredColumn($database, $field, $criteria) ); } @@ -283,7 +283,7 @@ class Database } // Return - return PHPExcel_Calculation_Statistical::COUNTA( + return Statistical::COUNTA( self::getFilteredColumn($database, $field, $criteria) ); } @@ -327,7 +327,7 @@ class Database // Return $colData = self::getFilteredColumn($database, $field, $criteria); if (count($colData) > 1) { - return PHPExcel_Calculation_Functions::NaN(); + return Functions::NaN(); } return $colData[0]; @@ -370,7 +370,7 @@ class Database } // Return - return PHPExcel_Calculation_Statistical::MAX( + return Statistical::MAX( self::getFilteredColumn($database, $field, $criteria) ); } @@ -412,7 +412,7 @@ class Database } // Return - return PHPExcel_Calculation_Statistical::MIN( + return Statistical::MIN( self::getFilteredColumn($database, $field, $criteria) ); } @@ -453,7 +453,7 @@ class Database } // Return - return PHPExcel_Calculation_MathTrig::PRODUCT( + return MathTrig::PRODUCT( self::getFilteredColumn($database, $field, $criteria) ); } @@ -495,7 +495,7 @@ class Database } // Return - return PHPExcel_Calculation_Statistical::STDEV( + return Statistical::STDEV( self::getFilteredColumn($database, $field, $criteria) ); } @@ -537,7 +537,7 @@ class Database } // Return - return PHPExcel_Calculation_Statistical::STDEVP( + return Statistical::STDEVP( self::getFilteredColumn($database, $field, $criteria) ); } @@ -578,7 +578,7 @@ class Database } // Return - return PHPExcel_Calculation_MathTrig::SUM( + return MathTrig::SUM( self::getFilteredColumn($database, $field, $criteria) ); } @@ -620,7 +620,7 @@ class Database } // Return - return PHPExcel_Calculation_Statistical::VARFunc( + return Statistical::VARFunc( self::getFilteredColumn($database, $field, $criteria) ); } @@ -662,7 +662,7 @@ class Database } // Return - return PHPExcel_Calculation_Statistical::VARP( + return Statistical::VARP( self::getFilteredColumn($database, $field, $criteria) ); } diff --git a/classes/src/Calculation/DateTime.php b/classes/src/Calculation/DateTime.php index 61a052c6..6d163cf1 100644 --- a/classes/src/Calculation/DateTime.php +++ b/classes/src/Calculation/DateTime.php @@ -88,16 +88,16 @@ class DateTime { if (!is_numeric($dateValue)) { if ((is_string($dateValue)) && - (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) { - return PHPExcel_Calculation_Functions::VALUE(); + (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) { + return Functions::VALUE(); } if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) { - $dateValue = PHPExcel_Shared_Date::PHPToExcel($dateValue); + $dateValue = \PHPExcel\Shared\Date::PHPToExcel($dateValue); } else { - $saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType(); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + $saveReturnDateType = Functions::getReturnDateType(); + Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); $dateValue = self::DATEVALUE($dateValue); - PHPExcel_Calculation_Functions::setReturnDateType($saveReturnDateType); + Functions::setReturnDateType($saveReturnDateType); } } return $dateValue; @@ -112,10 +112,10 @@ class DateTime */ private static function getTimeValue($timeValue) { - $saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType(); - PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); + $saveReturnDateType = Functions::getReturnDateType(); + Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); $timeValue = self::TIMEVALUE($timeValue); - PHPExcel_Calculation_Functions::setReturnDateType($saveReturnDateType); + Functions::setReturnDateType($saveReturnDateType); return $timeValue; } @@ -123,7 +123,7 @@ class DateTime private static function adjustDateByMonths($dateValue = 0, $adjustmentMonths = 0) { // Execute function - $PHPDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($dateValue); + $PHPDateObject = \PHPExcel\Shared\Date::ExcelToPHPObject($dateValue); $oMonth = (int) $PHPDateObject->format('m'); $oYear = (int) $PHPDateObject->format('Y'); @@ -171,14 +171,14 @@ class DateTime $saveTimeZone = date_default_timezone_get(); date_default_timezone_set('UTC'); $retValue = false; - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL: - $retValue = (float) PHPExcel_Shared_Date::PHPToExcel(time()); + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: + $retValue = (float) \PHPExcel\Shared\Date::PHPToExcel(time()); break; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC: + case Functions::RETURNDATE_PHP_NUMERIC: $retValue = (integer) time(); break; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT: + case Functions::RETURNDATE_PHP_OBJECT: $retValue = new DateTime(); break; } @@ -212,16 +212,16 @@ class DateTime $saveTimeZone = date_default_timezone_get(); date_default_timezone_set('UTC'); $retValue = false; - $excelDateTime = floor(PHPExcel_Shared_Date::PHPToExcel(time())); - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL: + $excelDateTime = floor(\PHPExcel\Shared\Date::PHPToExcel(time())); + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: $retValue = (float) $excelDateTime; break; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC: - $retValue = (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateTime); + case Functions::RETURNDATE_PHP_NUMERIC: + $retValue = (integer) \PHPExcel\Shared\Date::ExcelToPHP($excelDateTime); break; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT: - $retValue = PHPExcel_Shared_Date::ExcelToPHPObject($excelDateTime); + case Functions::RETURNDATE_PHP_OBJECT: + $retValue = \PHPExcel\Shared\Date::ExcelToPHPObject($excelDateTime); break; } date_default_timezone_set($saveTimeZone); @@ -282,37 +282,37 @@ class DateTime */ public static function DATE($year = 0, $month = 1, $day = 1) { - $year = PHPExcel_Calculation_Functions::flattenSingleValue($year); - $month = PHPExcel_Calculation_Functions::flattenSingleValue($month); - $day = PHPExcel_Calculation_Functions::flattenSingleValue($day); + $year = Functions::flattenSingleValue($year); + $month = Functions::flattenSingleValue($month); + $day = Functions::flattenSingleValue($day); if (($month !== null) && (!is_numeric($month))) { - $month = PHPExcel_Shared_Date::monthStringToNumber($month); + $month = \PHPExcel\Shared\Date::monthStringToNumber($month); } if (($day !== null) && (!is_numeric($day))) { - $day = PHPExcel_Shared_Date::dayStringToNumber($day); + $day = \PHPExcel\Shared\Date::dayStringToNumber($day); } - $year = ($year !== null) ? PHPExcel_Shared_String::testStringAsNumeric($year) : 0; - $month = ($month !== null) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0; - $day = ($day !== null) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0; + $year = ($year !== null) ? \PHPExcel\Shared\String::testStringAsNumeric($year) : 0; + $month = ($month !== null) ? \PHPExcel\Shared\String::testStringAsNumeric($month) : 0; + $day = ($day !== null) ? \PHPExcel\Shared\String::testStringAsNumeric($day) : 0; if ((!is_numeric($year)) || (!is_numeric($month)) || (!is_numeric($day))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Functions::VALUE(); } $year = (integer) $year; $month = (integer) $month; $day = (integer) $day; - $baseYear = PHPExcel_Shared_Date::getExcelCalendar(); + $baseYear = \PHPExcel\Shared\Date::getExcelCalendar(); // Validate parameters if ($year < ($baseYear-1900)) { - return PHPExcel_Calculation_Functions::NaN(); + return Functions::NaN(); } if ((($baseYear-1900) != 0) && ($year < $baseYear) && ($year >= 1900)) { - return PHPExcel_Calculation_Functions::NaN(); + return Functions::NaN(); } if (($year < $baseYear) && ($year >= ($baseYear-1900))) { @@ -332,18 +332,18 @@ class DateTime // Re-validate the year parameter after adjustments if (($year < $baseYear) || ($year >= 10000)) { - return PHPExcel_Calculation_Functions::NaN(); + return Functions::NaN(); } // Execute function - $excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day); - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL: + $excelDateValue = \PHPExcel\Shared\Date::FormattedPHPToExcel($year, $month, $day); + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: return (float) $excelDateValue; - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC: - return (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateValue); - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT: - return PHPExcel_Shared_Date::ExcelToPHPObject($excelDateValue); + case Functions::RETURNDATE_PHP_NUMERIC: + return (integer) \PHPExcel\Shared\Date::ExcelToPHP($excelDateValue); + case Functions::RETURNDATE_PHP_OBJECT: + return \PHPExcel\Shared\Date::ExcelToPHPObject($excelDateValue); } } @@ -377,9 +377,9 @@ class DateTime */ public static function TIME($hour = 0, $minute = 0, $second = 0) { - $hour = PHPExcel_Calculation_Functions::flattenSingleValue($hour); - $minute = PHPExcel_Calculation_Functions::flattenSingleValue($minute); - $second = PHPExcel_Calculation_Functions::flattenSingleValue($second); + $hour = Functions::flattenSingleValue($hour); + $minute = Functions::flattenSingleValue($minute); + $second = Functions::flattenSingleValue($second); if ($hour == '') { $hour = 0; @@ -392,7 +392,7 @@ class DateTime } if ((!is_numeric($hour)) || (!is_numeric($minute)) || (!is_numeric($second))) { - return PHPExcel_Calculation_Functions::VALUE(); + return Functions::VALUE(); } $hour = (integer) $hour; $minute = (integer) $minute; @@ -422,21 +422,21 @@ class DateTime if ($hour > 23) { $hour = $hour % 24; } elseif ($hour < 0) { - return PHPExcel_Calculation_Functions::NaN(); + return Functions::NaN(); } // Execute function - switch (PHPExcel_Calculation_Functions::getReturnDateType()) { - case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL: + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: $date = 0; - $calendar = PHPExcel_Shared_Date::getExcelCalendar(); - if ($calendar != PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900) { + $calendar = \PHPExcel\Shared\Date::getExcelCalendar(); + if ($calendar != PHPExcel\Shared\Date::CALENDAR_WINDOWS_1900) { $date = 1; } - return (float) PHPExcel_Shared_Date::FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC: - return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::FormattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 - case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT: + return (float) \PHPExcel\Shared\Date::FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); + case Functions::RETURNDATE_PHP_NUMERIC: + return (integer) \PHPExcel\Shared\Date::ExcelToPHP(\PHPExcel\Shared\Date::FormattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 + case Functions::RETURNDATE_PHP_OBJECT: $dayAdjust = 0; if ($hour < 0) { $dayAdjust = floor($hour / 24); @@ -485,7 +485,7 @@ class DateTime */ public static function DATEVALUE($dateValue = 1) { - $dateValue = trim(PHPExcel_Calculation_Functions::flattenSingleValue($dateValue), '"'); + $dateValue = trim(Functions::flattenSingleValue($dateValue), '"'); // Strip any ordinals because they're allowed in Excel (English only) $dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue); // Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany) @@ -496,7 +496,7 @@ class DateTime foreach ($t1 as &$t) { if ((is_numeric($t)) && ($t > 31)) { if ($yearFound) { - return PHPExcel_Calculation_Functions::VALUE(); + return Functions::VALUE(); } else { if ($t < 100) { $t += 1900;