123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?php
- class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
- {
-
- protected function storeData()
- {
- if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
- $this->currentObject->detach();
- $this->cellCache[$this->currentObjectID] = igbinary_serialize($this->currentObject);
- $this->currentCellIsDirty = false;
- }
- $this->currentObjectID = $this->currentObject = null;
- }
-
- public function addCacheData($pCoord, PHPExcel_Cell $cell)
- {
- if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
- $this->storeData();
- }
- $this->currentObjectID = $pCoord;
- $this->currentObject = $cell;
- $this->currentCellIsDirty = true;
- return $cell;
- }
-
- public function getCacheData($pCoord)
- {
- if ($pCoord === $this->currentObjectID) {
- return $this->currentObject;
- }
- $this->storeData();
-
- if (!isset($this->cellCache[$pCoord])) {
-
- return null;
- }
-
- $this->currentObjectID = $pCoord;
- $this->currentObject = igbinary_unserialize($this->cellCache[$pCoord]);
-
- $this->currentObject->attach($this);
-
- return $this->currentObject;
- }
-
- public function getCellList()
- {
- if ($this->currentObjectID !== null) {
- $this->storeData();
- }
- return parent::getCellList();
- }
-
- public function unsetWorksheetCells()
- {
- if (!is_null($this->currentObject)) {
- $this->currentObject->detach();
- $this->currentObject = $this->currentObjectID = null;
- }
- $this->cellCache = array();
-
- $this->parent = null;
- }
-
- public static function cacheMethodIsAvailable()
- {
- if (!function_exists('igbinary_serialize')) {
- return false;
- }
- return true;
- }
- }
|