ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
MemorySerialized.php
Go to the documentation of this file.
1<?php
37
45 protected function _storeData() {
46 if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
47 $this->_currentObject->detach();
48
49 $this->_cellCache[$this->_currentObjectID] = serialize($this->_currentObject);
50 $this->_currentCellIsDirty = false;
51 }
52 $this->_currentObjectID = $this->_currentObject = null;
53 } // function _storeData()
54
55
64 public function addCacheData($pCoord, PHPExcel_Cell $cell) {
65 if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
66 $this->_storeData();
67 }
68
69 $this->_currentObjectID = $pCoord;
70 $this->_currentObject = $cell;
71 $this->_currentCellIsDirty = true;
72
73 return $cell;
74 } // function addCacheData()
75
76
84 public function getCacheData($pCoord) {
85 if ($pCoord === $this->_currentObjectID) {
87 }
88 $this->_storeData();
89
90 // Check if the entry that has been requested actually exists
91 if (!isset($this->_cellCache[$pCoord])) {
92 // Return null if requested entry doesn't exist in cache
93 return null;
94 }
95
96 // Set current entry to the requested entry
97 $this->_currentObjectID = $pCoord;
98 $this->_currentObject = unserialize($this->_cellCache[$pCoord]);
99 // Re-attach this as the cell's parent
100 $this->_currentObject->attach($this);
101
102 // Return requested entry
104 } // function getCacheData()
105
106
112 public function getCellList() {
113 if ($this->_currentObjectID !== null) {
114 $this->_storeData();
115 }
116
117 return parent::getCellList();
118 }
119
120
126 public function unsetWorksheetCells() {
127 if(!is_null($this->_currentObject)) {
128 $this->_currentObject->detach();
129 $this->_currentObject = $this->_currentObjectID = null;
130 }
131 $this->_cellCache = array();
132
133 // detach ourself from the worksheet, so that it can then delete this object successfully
134 $this->_parent = null;
135 } // function unsetWorksheetCells()
136
137}
An exception for terminatinating execution or to throw for unit testing.
getCellList()
Get a list of all cell addresses currently held in cache.
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
getCacheData($pCoord)
Get cell at a specific coordinate.
addCacheData($pCoord, PHPExcel_Cell $cell)
Add or Update a cell in cache identified by coordinate address.
unsetWorksheetCells()
Clear the cell collection and disconnect from our parent.