From 3d7153c7f4baeb3a9138092f48b5e7b89b026e81 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Wed, 21 Mar 2012 23:55:54 +0000 Subject: [PATCH] Doc Block changes git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@88175 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Autoloader.php | 60 +++++++++----- Classes/PHPExcel/CachedObjectStorage/APC.php | 32 ++++++++ .../CachedObjectStorage/CacheBase.php | 11 +++ .../PHPExcel/CachedObjectStorage/DiscISAM.php | 38 +++++++++ .../PHPExcel/CachedObjectStorage/ICache.php | 2 +- .../PHPExcel/CachedObjectStorage/Igbinary.php | 12 +++ .../PHPExcel/CachedObjectStorage/Memcache.php | 44 ++++++++++ .../PHPExcel/CachedObjectStorage/Memory.php | 11 +++ .../CachedObjectStorage/MemoryGZip.php | 12 +++ .../CachedObjectStorage/MemorySerialized.php | 12 +++ .../PHPExcel/CachedObjectStorage/PHPTemp.php | 33 +++++++- .../PHPExcel/CachedObjectStorage/SQLite.php | 38 ++++++++- .../PHPExcel/CachedObjectStorage/SQLite3.php | 38 ++++++++- .../PHPExcel/CachedObjectStorage/Wincache.php | 33 +++++++- .../PHPExcel/CachedObjectStorageFactory.php | 80 ++++++++++++++++--- Classes/PHPExcel/Cell.php | 3 +- 16 files changed, 418 insertions(+), 41 deletions(-) diff --git a/Classes/PHPExcel/Autoloader.php b/Classes/PHPExcel/Autoloader.php index 9d70fb10..b11df94e 100644 --- a/Classes/PHPExcel/Autoloader.php +++ b/Classes/PHPExcel/Autoloader.php @@ -34,34 +34,50 @@ if (ini_get('mbstring.func_overload') & 2) { PHPExcel_Shared_String::buildCharacterSets(); +/** + * PHPExcel_Autoloader + * + * @category PHPExcel + * @package PHPExcel + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + */ class PHPExcel_Autoloader { - public static function Register() { - if (function_exists('__autoload')) { - // Register any existing autoloader function with SPL, so we don't get any clashes - spl_autoload_register('__autoload'); - } - // Register ourselves with SPL - return spl_autoload_register(array('PHPExcel_Autoloader', 'Load')); - } // function Register() + /** + * Register the Autoloader with SPL + * + */ + public static function Register() { + if (function_exists('__autoload')) { + // Register any existing autoloader function with SPL, so we don't get any clashes + spl_autoload_register('__autoload'); + } + // Register ourselves with SPL + return spl_autoload_register(array('PHPExcel_Autoloader', 'Load')); + } // function Register() - public static function Load($pObjectName){ - if ((class_exists($pObjectName)) || (strpos($pObjectName, 'PHPExcel') !== 0)) { - // Either already loaded, or not a PHPExcel class request - return FALSE; - } + /** + * Autoload a class identified by name + * + * @param string $pClassName Name of the object to load + */ + public static function Load($pClassName){ + if ((class_exists($pClassName)) || (strpos($pClassName, 'PHPExcel') !== 0)) { + // Either already loaded, or not a PHPExcel class request + return FALSE; + } - $pObjectFilePath = PHPEXCEL_ROOT . - str_replace('_',DIRECTORY_SEPARATOR,$pObjectName) . - '.php'; + $pObjectFilePath = PHPEXCEL_ROOT . + str_replace('_',DIRECTORY_SEPARATOR,$pClassName) . + '.php'; - if ((file_exists($pObjectFilePath) === false) || (is_readable($pObjectFilePath) === false)) { - // Can't load - return FALSE; - } + if ((file_exists($pObjectFilePath) === false) || (is_readable($pObjectFilePath) === false)) { + // Can't load + return FALSE; + } - require($pObjectFilePath); - } // function Load() + require($pObjectFilePath); + } // function Load() } \ No newline at end of file diff --git a/Classes/PHPExcel/CachedObjectStorage/APC.php b/Classes/PHPExcel/CachedObjectStorage/APC.php index c888059d..fca364af 100644 --- a/Classes/PHPExcel/CachedObjectStorage/APC.php +++ b/Classes/PHPExcel/CachedObjectStorage/APC.php @@ -35,11 +35,28 @@ */ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { + /** + * Prefix used to uniquely identify cache data for this worksheet + * + * @var string + */ private $_cachePrefix = null; + /** + * Cache timeout + * + * @var integer + */ private $_cacheTime = 600; + /** + * Store cell data in cache for the current cell object if it's "dirty", + * and the 'nullify' the current cell object + * + * @return void + * @throws Exception + */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); @@ -157,6 +174,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach /** * Clone the cell collection * + * @param PHPExcel_Worksheet $parent The new worksheet * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { @@ -183,6 +201,11 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach } // function copyCellCollection() + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { if ($this->_currentObject !== NULL) { $this->_currentObject->detach(); @@ -199,6 +222,12 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach } // function unsetWorksheetCells() + /** + * Initialise this new 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) { $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; @@ -212,6 +241,9 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach } // function __construct() + /** + * Destroy this cell collection + */ public function __destruct() { $cacheList = $this->getCellList(); foreach($cacheList as $cellID) { diff --git a/Classes/PHPExcel/CachedObjectStorage/CacheBase.php b/Classes/PHPExcel/CachedObjectStorage/CacheBase.php index 4f2789ae..44975d4d 100644 --- a/Classes/PHPExcel/CachedObjectStorage/CacheBase.php +++ b/Classes/PHPExcel/CachedObjectStorage/CacheBase.php @@ -73,6 +73,11 @@ class PHPExcel_CachedObjectStorage_CacheBase { protected $_cellCache = array(); + /** + * Initialise this new cell collection + * + * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + */ public function __construct(PHPExcel_Worksheet $parent) { // Set our parent worksheet. // This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when @@ -205,6 +210,11 @@ class PHPExcel_CachedObjectStorage_CacheBase { } + /** + * Generate a unique ID for cache referencing + * + * @return string Unique Reference + */ protected function _getUniqueID() { if (function_exists('posix_getpid')) { $baseUnique = posix_getpid(); @@ -217,6 +227,7 @@ class PHPExcel_CachedObjectStorage_CacheBase { /** * Clone the cell collection * + * @param PHPExcel_Worksheet $parent The new worksheet * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { diff --git a/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php b/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php index aa0bd072..edae09da 100644 --- a/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php +++ b/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php @@ -35,12 +35,35 @@ */ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { + /** + * Name of the file for this cache + * + * @var string + */ private $_fileName = null; + + /** + * File handle for this cache file + * + * @var resource + */ private $_fileHandle = null; + /** + * Directory/Folder where the cache file is located + * + * @var string + */ private $_cacheDirectory = NULL; + /** + * Store cell data in cache for the current cell object if it's "dirty", + * and the 'nullify' the current cell object + * + * @return void + * @throws Exception + */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); @@ -112,6 +135,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage /** * Clone the cell collection * + * @param PHPExcel_Worksheet $parent The new worksheet * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { @@ -127,6 +151,11 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage } // function copyCellCollection() + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { if(!is_null($this->_currentObject)) { $this->_currentObject->detach(); @@ -142,6 +171,12 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage } // function unsetWorksheetCells() + /** + * Initialise this new 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) { $this->_cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== NULL)) ? $arguments['dir'] @@ -156,6 +191,9 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage } // function __construct() + /** + * Destroy this cell collection + */ public function __destruct() { if (!is_null($this->_fileHandle)) { fclose($this->_fileHandle); diff --git a/Classes/PHPExcel/CachedObjectStorage/ICache.php b/Classes/PHPExcel/CachedObjectStorage/ICache.php index cf6ca5c7..1caceea7 100644 --- a/Classes/PHPExcel/CachedObjectStorage/ICache.php +++ b/Classes/PHPExcel/CachedObjectStorage/ICache.php @@ -75,7 +75,6 @@ interface PHPExcel_CachedObjectStorage_ICache * 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 void * @return boolean */ public function isDataSet($pCoord); @@ -97,6 +96,7 @@ interface PHPExcel_CachedObjectStorage_ICache /** * Clone the cell collection * + * @param PHPExcel_Worksheet $parent The new worksheet * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent); diff --git a/Classes/PHPExcel/CachedObjectStorage/Igbinary.php b/Classes/PHPExcel/CachedObjectStorage/Igbinary.php index ecfe2d13..3728d678 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Igbinary.php +++ b/Classes/PHPExcel/CachedObjectStorage/Igbinary.php @@ -35,6 +35,13 @@ */ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_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 Exception + */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); @@ -97,6 +104,11 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage } // function getCacheData() + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { if(!is_null($this->_currentObject)) { $this->_currentObject->detach(); diff --git a/Classes/PHPExcel/CachedObjectStorage/Memcache.php b/Classes/PHPExcel/CachedObjectStorage/Memcache.php index 4af094db..a72fa191 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Memcache.php +++ b/Classes/PHPExcel/CachedObjectStorage/Memcache.php @@ -35,13 +35,35 @@ */ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { + /** + * Prefix used to uniquely identify cache data for this worksheet + * + * @var string + */ private $_cachePrefix = null; + /** + * Cache timeout + * + * @var integer + */ private $_cacheTime = 600; + /** + * Memcache interface + * + * @var resource + */ private $_memcache = null; + /** + * Store cell data in cache for the current cell object if it's "dirty", + * and the 'nullify' the current cell object + * + * @return void + * @throws Exception + */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); @@ -162,6 +184,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage /** * Clone the cell collection * + * @param PHPExcel_Worksheet $parent The new worksheet * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { @@ -188,6 +211,11 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage } // function copyCellCollection() + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { if(!is_null($this->_currentObject)) { $this->_currentObject->detach(); @@ -204,6 +232,12 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage } // function unsetWorksheetCells() + /** + * Initialise this new 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) { $memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost'; $memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211; @@ -225,11 +259,21 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage } // function __construct() + /** + * Memcache error handler + * + * @param string $host Memcache server + * @param integer $port Memcache port + * @throws Exception + */ public function failureCallback($host, $port) { throw new Exception('memcache '.$host.':'.$port.' failed'); } + /** + * Destroy this cell collection + */ public function __destruct() { $cacheList = $this->getCellList(); foreach($cacheList as $cellID) { diff --git a/Classes/PHPExcel/CachedObjectStorage/Memory.php b/Classes/PHPExcel/CachedObjectStorage/Memory.php index 4461b9bd..be84c43d 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Memory.php +++ b/Classes/PHPExcel/CachedObjectStorage/Memory.php @@ -68,6 +68,12 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C } // function getCacheData() + /** + * Clone the cell collection + * + * @param PHPExcel_Worksheet $parent The new worksheet + * @return void + */ public function copyCellCollection(PHPExcel_Worksheet $parent) { parent::copyCellCollection($parent); @@ -81,6 +87,11 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C } + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { // Because cells are all stored as intact objects in memory, we need to detach each one from the parent foreach($this->_cellCache as $k => &$cell) { diff --git a/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php b/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php index 4cb52443..9ee3aaea 100644 --- a/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php +++ b/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php @@ -35,6 +35,13 @@ */ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_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 Exception + */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); @@ -97,6 +104,11 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora } // function getCacheData() + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { if(!is_null($this->_currentObject)) { $this->_currentObject->detach(); diff --git a/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php b/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php index 47946062..82dc167b 100644 --- a/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php +++ b/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php @@ -35,6 +35,13 @@ */ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_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 Exception + */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); @@ -97,6 +104,11 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec } // function getCacheData() + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { if(!is_null($this->_currentObject)) { $this->_currentObject->detach(); diff --git a/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php b/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php index e2c732f1..e5af520b 100644 --- a/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php +++ b/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php @@ -35,11 +35,27 @@ */ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { + /** + * Name of the file for this cache + * + * @var string + */ private $_fileHandle = null; - + /** + * Memory limit to use before reverting to file cache + * + * @var integer + */ private $_memoryCacheSize = null; + /** + * Store cell data in cache for the current cell object if it's "dirty", + * and the 'nullify' the current cell object + * + * @return void + * @throws Exception + */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); @@ -111,6 +127,7 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ /** * Clone the cell collection * + * @param PHPExcel_Worksheet $parent The new worksheet * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { @@ -126,6 +143,11 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ } // function copyCellCollection() + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { if(!is_null($this->_currentObject)) { $this->_currentObject->detach(); @@ -141,6 +163,12 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ } // function unsetWorksheetCells() + /** + * Initialise this new 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) { $this->_memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB'; @@ -151,6 +179,9 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ } // function __construct() + /** + * Destroy this cell collection + */ public function __destruct() { if (!is_null($this->_fileHandle)) { fclose($this->_fileHandle); diff --git a/Classes/PHPExcel/CachedObjectStorage/SQLite.php b/Classes/PHPExcel/CachedObjectStorage/SQLite.php index e5085d48..56cc3f9b 100644 --- a/Classes/PHPExcel/CachedObjectStorage/SQLite.php +++ b/Classes/PHPExcel/CachedObjectStorage/SQLite.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2010 PHPExcel + * Copyright (c) 2006 - 2012 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ @@ -31,13 +31,31 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { + /** + * Database table name + * + * @var string + */ private $_TableName = null; + + /** + * Database handle + * + * @var resource + */ private $_DBHandle = null; + /** + * Store cell data in cache for the current cell object if it's "dirty", + * and the 'nullify' the current cell object + * + * @return void + * @throws Exception + */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); @@ -174,6 +192,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C /** * Clone the cell collection * + * @param PHPExcel_Worksheet $parent The new worksheet * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { @@ -188,6 +207,11 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C } // function copyCellCollection() + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { if(!is_null($this->_currentObject)) { $this->_currentObject->detach(); @@ -201,6 +225,11 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C } // function unsetWorksheetCells() + /** + * Initialise this new cell collection + * + * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + */ public function __construct(PHPExcel_Worksheet $parent) { parent::__construct($parent); if (is_null($this->_DBHandle)) { @@ -216,6 +245,9 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C } // function __construct() + /** + * Destroy this cell collection + */ public function __destruct() { $this->_DBHandle = null; } // function __destruct() diff --git a/Classes/PHPExcel/CachedObjectStorage/SQLite3.php b/Classes/PHPExcel/CachedObjectStorage/SQLite3.php index 7329ec54..65c1c697 100644 --- a/Classes/PHPExcel/CachedObjectStorage/SQLite3.php +++ b/Classes/PHPExcel/CachedObjectStorage/SQLite3.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2010 PHPExcel + * Copyright (c) 2006 - 2012 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ @@ -31,13 +31,31 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { + /** + * Database table name + * + * @var string + */ private $_TableName = null; + + /** + * Database handle + * + * @var resource + */ private $_DBHandle = null; + /** + * Store cell data in cache for the current cell object if it's "dirty", + * and the 'nullify' the current cell object + * + * @return void + * @throws Exception + */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); @@ -178,6 +196,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ /** * Clone the cell collection * + * @param PHPExcel_Worksheet $parent The new worksheet * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { @@ -192,6 +211,11 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ } // function copyCellCollection() + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { if(!is_null($this->_currentObject)) { $this->_currentObject->detach(); @@ -205,6 +229,11 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ } // function unsetWorksheetCells() + /** + * Initialise this new cell collection + * + * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + */ public function __construct(PHPExcel_Worksheet $parent) { parent::__construct($parent); if (is_null($this->_DBHandle)) { @@ -220,6 +249,9 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ } // function __construct() + /** + * Destroy this cell collection + */ public function __destruct() { if (!is_null($this->_DBHandle)) { $this->_DBHandle->close(); diff --git a/Classes/PHPExcel/CachedObjectStorage/Wincache.php b/Classes/PHPExcel/CachedObjectStorage/Wincache.php index 0c90dfea..30fe7e1f 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Wincache.php +++ b/Classes/PHPExcel/CachedObjectStorage/Wincache.php @@ -35,11 +35,28 @@ */ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { + /** + * Prefix used to uniquely identify cache data for this worksheet + * + * @var string + */ private $_cachePrefix = null; + /** + * Cache timeout + * + * @var integer + */ private $_cacheTime = 600; + /** + * Store cell data in cache for the current cell object if it's "dirty", + * and the 'nullify' the current cell object + * + * @return void + * @throws Exception + */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); @@ -89,7 +106,6 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage * 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 void * @return boolean */ public function isDataSet($pCoord) { @@ -168,6 +184,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage /** * Clone the cell collection * + * @param PHPExcel_Worksheet $parent The new worksheet * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { @@ -195,6 +212,11 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage } // function copyCellCollection() + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ public function unsetWorksheetCells() { if(!is_null($this->_currentObject)) { $this->_currentObject->detach(); @@ -211,6 +233,12 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage } // function unsetWorksheetCells() + /** + * Initialise this new 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) { $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; @@ -224,6 +252,9 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage } // function __construct() + /** + * Destroy this cell collection + */ public function __destruct() { $cacheList = $this->getCellList(); foreach($cacheList as $cellID) { diff --git a/Classes/PHPExcel/CachedObjectStorageFactory.php b/Classes/PHPExcel/CachedObjectStorageFactory.php index 9eda6f5b..0bda4caf 100644 --- a/Classes/PHPExcel/CachedObjectStorageFactory.php +++ b/Classes/PHPExcel/CachedObjectStorageFactory.php @@ -28,11 +28,11 @@ /** - * PHPExcel_IOFactory + * PHPExcel_CachedObjectStorageFactory * - * @category PHPExcel - * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @category PHPExcel + * @package PHPExcel_CachedObjectStorage + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorageFactory { @@ -49,11 +49,26 @@ class PHPExcel_CachedObjectStorageFactory const cache_to_sqlite3 = 'SQLite3'; + /** + * Name of the method used for cell cacheing + * + * @var string + */ private static $_cacheStorageMethod = NULL; + /** + * Name of the class used for cell cacheing + * + * @var string + */ private static $_cacheStorageClass = NULL; + /** + * List of all possible cache storage methods + * + * @var string[] + */ private static $_storageMethods = array( self::cache_in_memory, self::cache_in_memory_gzip, @@ -69,6 +84,11 @@ class PHPExcel_CachedObjectStorageFactory ); + /** + * Default arguments for each cache storage method + * + * @var array of mixed array + */ private static $_storageMethodDefaultParameters = array( self::cache_in_memory => array( ), @@ -97,9 +117,19 @@ class PHPExcel_CachedObjectStorageFactory ); + /** + * Arguments for the active cache storage method + * + * @var array of mixed array + */ private static $_storageMethodParameters = array(); + /** + * Return the current cache storage method + * + * @return string|NULL + **/ public static function getCacheStorageMethod() { if (self::$_cacheStorageMethod !== NULL) { @@ -109,6 +139,11 @@ class PHPExcel_CachedObjectStorageFactory } // function getCacheStorageMethod() + /** + * Return the current cache storage class + * + * @return PHPExcel_CachedObjectStorage_ICache|NULL + **/ public static function getCacheStorageClass() { if (self::$_cacheStorageClass !== NULL) { @@ -118,18 +153,28 @@ class PHPExcel_CachedObjectStorageFactory } // function getCacheStorageClass() + /** + * Return the list of all possible cache storage methods + * + * @return string[] + **/ public static function getAllCacheStorageMethods() { return self::$_storageMethods; } // function getCacheStorageMethods() + /** + * Return the list of all available cache storage methods + * + * @return string[] + **/ public static function getCacheStorageMethods() { $activeMethods = array(); foreach(self::$_storageMethods as $storageMethod) { - $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$storageMethod; - if (call_user_func(array($cacheStorageClass,'cacheMethodIsAvailable'))) { + $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod; + if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) { $activeMethods[] = $storageMethod; } } @@ -137,6 +182,14 @@ class PHPExcel_CachedObjectStorageFactory } // function getCacheStorageMethods() + /** + * Identify the cache storage method to use + * + * @param string $method Name of the method to use for cell cacheing + * @param array of mixed $arguments Additional arguments to pass to the cell caching class + * when instantiating + * @return boolean + **/ public static function initialize($method = self::cache_in_memory, $arguments = array()) { if (!in_array($method,self::$_storageMethods)) { @@ -144,7 +197,8 @@ class PHPExcel_CachedObjectStorageFactory } $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; - if (!call_user_func(array($cacheStorageClass,'cacheMethodIsAvailable'))) { + if (!call_user_func(array( $cacheStorageClass, + 'cacheMethodIsAvailable'))) { return FALSE; } @@ -156,13 +210,19 @@ class PHPExcel_CachedObjectStorageFactory } if (self::$_cacheStorageMethod === NULL) { - self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; + self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method; self::$_cacheStorageMethod = $method; } return TRUE; } // function initialize() + /** + * Initialise the cache storage + * + * @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet + * @return PHPExcel_CachedObjectStorage_ICache + **/ public static function getInstance(PHPExcel_Worksheet $parent) { $cacheMethodIsAvailable = TRUE; @@ -171,7 +231,9 @@ class PHPExcel_CachedObjectStorageFactory } if ($cacheMethodIsAvailable) { - $instance = new self::$_cacheStorageClass($parent,self::$_storageMethodParameters[self::$_cacheStorageMethod]); + $instance = new self::$_cacheStorageClass( $parent, + self::$_storageMethodParameters[self::$_cacheStorageMethod] + ); if ($instance !== NULL) { return $instance; } diff --git a/Classes/PHPExcel/Cell.php b/Classes/PHPExcel/Cell.php index 52ca221b..8ded7221 100644 --- a/Classes/PHPExcel/Cell.php +++ b/Classes/PHPExcel/Cell.php @@ -101,6 +101,7 @@ class PHPExcel_Cell /** * Send notification to the cache controller + * * @return void **/ public function notifyCacheController() { @@ -121,7 +122,7 @@ class PHPExcel_Cell * Create a new Cell * * @param string $pColumn - * @param int $pRow + * @param int $pRow * @param mixed $pValue * @param string $pDataType * @param PHPExcel_Worksheet $pSheet