Skip to content

Commit

Permalink
PHPOfficeGH-78 replaced Exception with PHPExcel_Exception in all Cach…
Browse files Browse the repository at this point in the history
…e classes
  • Loading branch information
Dominik Bonsch committed Nov 19, 2012
1 parent f02d1ed commit 13a9413
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 76 deletions.
18 changes: 9 additions & 9 deletions Classes/PHPExcel/CachedObjectStorage/APC.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
*
* @access private
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
private function _storeData() {
if ($this->_currentCellIsDirty) {
$this->_currentObject->detach();

if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
$this->__destruct();
throw new Exception('Failed to store cell '.$this->_currentObjectID.' in APC');
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in APC');
}
$this->_currentCellIsDirty = false;
}
Expand All @@ -81,7 +81,7 @@ private function _storeData() {
* @param string $pCoord Coordinate address of the cell to update
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
Expand Down Expand Up @@ -116,7 +116,7 @@ public function isDataSet($pCoord) {
if ($success === false) {
// Entry no longer exists in APC, so clear it from the cache array
parent::deleteCacheData($pCoord);
throw new Exception('Cell entry '.$pCoord.' no longer exists in APC');
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC');
}
return true;
}
Expand All @@ -129,7 +129,7 @@ public function isDataSet($pCoord) {
*
* @access public
* @param string $pCoord Coordinate of the cell
* @throws Exception
* @throws PHPExcel_Exception
* @return PHPExcel_Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord) {
Expand All @@ -144,7 +144,7 @@ public function getCacheData($pCoord) {
if ($obj === false) {
// Entry no longer exists in APC, so clear it from the cache array
parent::deleteCacheData($pCoord);
throw new Exception('Cell entry '.$pCoord.' no longer exists in APC');
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC');
}
} else {
// Return null if requested entry doesn't exist in cache
Expand All @@ -167,7 +167,7 @@ public function getCacheData($pCoord) {
*
* @access public
* @param string $pCoord Coordinate address of the cell to delete
* @throws Exception
* @throws PHPExcel_Exception
*/
public function deleteCacheData($pCoord) {
// Delete the entry from APC
Expand Down Expand Up @@ -197,11 +197,11 @@ public function copyCellCollection(PHPExcel_Worksheet $parent) {
if ($obj === false) {
// Entry no longer exists in APC, so clear it from the cache array
parent::deleteCacheData($cellID);
throw new Exception('Cell entry '.$cellID.' no longer exists in APC');
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in APC');
}
if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) {
$this->__destruct();
throw new Exception('Failed to store cell '.$cellID.' in APC');
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in APC');
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions Classes/PHPExcel/CachedObjectStorage/CacheBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ public function isDataSet($pCoord) {
* Add or Update a cell in cache
*
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @throws Exception
* @return void
*/
public function updateCacheData(PHPExcel_Cell $cell) {
return $this->addCacheData($cell->getCoordinate(),$cell);
Expand All @@ -117,7 +116,6 @@ public function updateCacheData(PHPExcel_Cell $cell) {
* Delete a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to delete
* @throws Exception
*/
public function deleteCacheData($pCoord) {
if ($pCoord === $this->_currentObjectID) {
Expand Down
3 changes: 0 additions & 3 deletions Classes/PHPExcel/CachedObjectStorage/DiscISAM.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
* and the 'nullify' the current cell object
*
* @return void
* @throws Exception
*/
private function _storeData() {
if ($this->_currentCellIsDirty) {
Expand All @@ -86,7 +85,6 @@ private function _storeData() {
* @param string $pCoord Coordinate address of the cell to update
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @throws Exception
*/
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
Expand All @@ -105,7 +103,6 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) {
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws Exception
* @return PHPExcel_Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord) {
Expand Down
8 changes: 4 additions & 4 deletions Classes/PHPExcel/CachedObjectStorage/ICache.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface PHPExcel_CachedObjectStorage_ICache
* @param string $pCoord Coordinate address of the cell to update
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
public function addCacheData($pCoord, PHPExcel_Cell $cell);

Expand All @@ -50,7 +50,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell);
*
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
public function updateCacheData(PHPExcel_Cell $cell);

Expand All @@ -59,15 +59,15 @@ public function updateCacheData(PHPExcel_Cell $cell);
*
* @param string $pCoord Coordinate address of the cell to retrieve
* @return PHPExcel_Cell Cell that was found, or null if not found
* @throws Exception
* @throws PHPExcel_Exception
*/
public function getCacheData($pCoord);

/**
* Delete a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to delete
* @throws Exception
* @throws PHPExcel_Exception
*/
public function deleteCacheData($pCoord);

Expand Down
24 changes: 12 additions & 12 deletions Classes/PHPExcel/CachedObjectStorage/Memcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
* and the 'nullify' the current cell object
*
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
private function _storeData() {
if ($this->_currentCellIsDirty) {
Expand All @@ -72,7 +72,7 @@ private function _storeData() {
if (!$this->_memcache->replace($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) {
if (!$this->_memcache->add($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) {
$this->__destruct();
throw new Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache');
throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache');
}
}
$this->_currentCellIsDirty = false;
Expand All @@ -87,7 +87,7 @@ private function _storeData() {
* @param string $pCoord Coordinate address of the cell to update
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
Expand Down Expand Up @@ -121,7 +121,7 @@ public function isDataSet($pCoord) {
if ($success === false) {
// Entry no longer exists in Memcache, so clear it from the cache array
parent::deleteCacheData($pCoord);
throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
}
return true;
}
Expand All @@ -133,7 +133,7 @@ public function isDataSet($pCoord) {
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws Exception
* @throws PHPExcel_Exception
* @return PHPExcel_Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord) {
Expand All @@ -148,7 +148,7 @@ public function getCacheData($pCoord) {
if ($obj === false) {
// Entry no longer exists in Memcache, so clear it from the cache array
parent::deleteCacheData($pCoord);
throw new 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
Expand All @@ -170,7 +170,7 @@ public function getCacheData($pCoord) {
* Delete a cell in cache identified by coordinate address
*
* @param string $pCoord Coordinate address of the cell to delete
* @throws Exception
* @throws PHPExcel_Exception
*/
public function deleteCacheData($pCoord) {
// Delete the entry from Memcache
Expand Down Expand Up @@ -199,11 +199,11 @@ public function copyCellCollection(PHPExcel_Worksheet $parent) {
if ($obj === false) {
// Entry no longer exists in Memcache, so clear it from the cache array
parent::deleteCacheData($cellID);
throw new 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 Exception('Failed to store cell '.$cellID.' in MemCache');
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in MemCache');
}
}
}
Expand Down Expand Up @@ -250,7 +250,7 @@ public function __construct(PHPExcel_Worksheet $parent, $arguments) {
// 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 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;

Expand All @@ -264,10 +264,10 @@ public function __construct(PHPExcel_Worksheet $parent, $arguments) {
*
* @param string $host Memcache server
* @param integer $port Memcache port
* @throws Exception
* @throws PHPExcel_Exception
*/
public function failureCallback($host, $port) {
throw new Exception('memcache '.$host.':'.$port.' failed');
throw new PHPExcel_Exception('memcache '.$host.':'.$port.' failed');
}


Expand Down
4 changes: 2 additions & 2 deletions Classes/PHPExcel/CachedObjectStorage/Memory.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
* @param string $pCoord Coordinate address of the cell to update
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
$this->_cellCache[$pCoord] = $cell;
Expand All @@ -53,7 +53,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) {
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws Exception
* @throws PHPExcel_Exception
* @return PHPExcel_Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord) {
Expand Down
6 changes: 3 additions & 3 deletions Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora
* and the 'nullify' the current cell object
*
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
private function _storeData() {
if ($this->_currentCellIsDirty) {
Expand All @@ -59,7 +59,7 @@ private function _storeData() {
* @param string $pCoord Coordinate address of the cell to update
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
Expand All @@ -78,7 +78,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) {
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws Exception
* @throws PHPExcel_Exception
* @return PHPExcel_Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord) {
Expand Down
6 changes: 3 additions & 3 deletions Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec
* and the 'nullify' the current cell object
*
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
private function _storeData() {
if ($this->_currentCellIsDirty) {
Expand All @@ -59,7 +59,7 @@ private function _storeData() {
* @param string $pCoord Coordinate address of the cell to update
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
Expand All @@ -78,7 +78,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) {
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws Exception
* @throws PHPExcel_Exception
* @return PHPExcel_Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord) {
Expand Down
6 changes: 3 additions & 3 deletions Classes/PHPExcel/CachedObjectStorage/PHPTemp.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
* and the 'nullify' the current cell object
*
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
private function _storeData() {
if ($this->_currentCellIsDirty) {
Expand All @@ -78,7 +78,7 @@ private function _storeData() {
* @param string $pCoord Coordinate address of the cell to update
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @throws Exception
* @throws PHPExcel_Exception
*/
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
Expand All @@ -97,7 +97,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) {
* Get cell at a specific coordinate
*
* @param string $pCoord Coordinate of the cell
* @throws Exception
* @throws PHPExcel_Exception
* @return PHPExcel_Cell Cell that was found, or null if not found
*/
public function getCacheData($pCoord) {
Expand Down
Loading

0 comments on commit 13a9413

Please sign in to comment.