@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | $this->currentObject->detach(); |
62 | 62 | |
63 | 63 | $obj = serialize($this->currentObject); |
64 | - if (!$this->memcache->replace($this->cachePrefix.$this->currentObjectID.'.cache', $obj, null, $this->cacheTime)) { |
|
65 | - if (!$this->memcache->add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, null, $this->cacheTime)) { |
|
64 | + if (!$this->memcache->replace($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) { |
|
65 | + if (!$this->memcache->add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) { |
|
66 | 66 | $this->__destruct(); |
67 | 67 | throw new \PhpOffice\PhpSpreadsheet\Exception("Failed to store cell {$this->currentObjectID} in MemCache"); |
68 | 68 | } |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | return true; |
114 | 114 | } |
115 | 115 | // Check if the requested entry still exists in Memcache |
116 | - $success = $this->memcache->get($this->cachePrefix.$pCoord.'.cache'); |
|
116 | + $success = $this->memcache->get($this->cachePrefix . $pCoord . '.cache'); |
|
117 | 117 | if ($success === false) { |
118 | 118 | // Entry no longer exists in Memcache, so clear it from the cache array |
119 | 119 | parent::deleteCacheData($pCoord); |
120 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); |
|
120 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in MemCache'); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return true; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | // Check if the entry that has been requested actually exists |
146 | 146 | if (parent::isDataSet($pCoord)) { |
147 | - $obj = $this->memcache->get($this->cachePrefix.$pCoord.'.cache'); |
|
147 | + $obj = $this->memcache->get($this->cachePrefix . $pCoord . '.cache'); |
|
148 | 148 | if ($obj === false) { |
149 | 149 | // Entry no longer exists in Memcache, so clear it from the cache array |
150 | 150 | parent::deleteCacheData($pCoord); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | public function deleteCacheData($pCoord) |
190 | 190 | { |
191 | 191 | // Delete the entry from Memcache |
192 | - $this->memcache->delete($this->cachePrefix.$pCoord.'.cache'); |
|
192 | + $this->memcache->delete($this->cachePrefix . $pCoord . '.cache'); |
|
193 | 193 | |
194 | 194 | // Delete the entry from our cell address array |
195 | 195 | parent::deleteCacheData($pCoord); |
@@ -207,17 +207,17 @@ discard block |
||
207 | 207 | parent::copyCellCollection($parent); |
208 | 208 | // Get a new id for the new file name |
209 | 209 | $baseUnique = $this->getUniqueID(); |
210 | - $newCachePrefix = substr(md5($baseUnique), 0, 8).'.'; |
|
210 | + $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.'; |
|
211 | 211 | $cacheList = $this->getCellList(); |
212 | 212 | foreach ($cacheList as $cellID) { |
213 | 213 | if ($cellID != $this->currentObjectID) { |
214 | - $obj = $this->memcache->get($this->cachePrefix.$cellID.'.cache'); |
|
214 | + $obj = $this->memcache->get($this->cachePrefix . $cellID . '.cache'); |
|
215 | 215 | if ($obj === false) { |
216 | 216 | // Entry no longer exists in Memcache, so clear it from the cache array |
217 | 217 | parent::deleteCacheData($cellID); |
218 | 218 | throw new \PhpOffice\PhpSpreadsheet\Exception("Cell entry {$cellID} no longer exists in MemCache"); |
219 | 219 | } |
220 | - if (!$this->memcache->add($newCachePrefix.$cellID.'.cache', $obj, null, $this->cacheTime)) { |
|
220 | + if (!$this->memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->cacheTime)) { |
|
221 | 221 | $this->__destruct(); |
222 | 222 | throw new \PhpOffice\PhpSpreadsheet\Exception("Failed to store cell {$cellID} in MemCache"); |
223 | 223 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | if (is_null($this->cachePrefix)) { |
263 | 263 | $baseUnique = $this->getUniqueID(); |
264 | - $this->cachePrefix = substr(md5($baseUnique), 0, 8).'.'; |
|
264 | + $this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.'; |
|
265 | 265 | |
266 | 266 | // Set a new Memcache object and connect to the Memcache server |
267 | 267 | $this->memcache = new \Memcache(); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | { |
295 | 295 | $cacheList = $this->getCellList(); |
296 | 296 | foreach ($cacheList as $cellID) { |
297 | - $this->memcache->delete($this->cachePrefix.$cellID.'.cache'); |
|
297 | + $this->memcache->delete($this->cachePrefix . $cellID . '.cache'); |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | parent::copyCellCollection($parent); |
145 | 145 | // Open a new stream for the cell cache data |
146 | - $newFileHandle = fopen('php://temp/maxmemory:'.$this->memoryCacheSize, 'a+'); |
|
146 | + $newFileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+'); |
|
147 | 147 | // Copy the existing cell cache data to the new stream |
148 | 148 | fseek($this->fileHandle, 0); |
149 | 149 | while (!feof($this->fileHandle)) { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | parent::__construct($parent); |
184 | 184 | if (is_null($this->fileHandle)) { |
185 | - $this->fileHandle = fopen('php://temp/maxmemory:'.$this->memoryCacheSize, 'a+'); |
|
185 | + $this->fileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+'); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | $this->currentObject->detach(); |
55 | 55 | |
56 | 56 | if (!apc_store( |
57 | - $this->cachePrefix.$this->currentObjectID.'.cache', |
|
57 | + $this->cachePrefix . $this->currentObjectID . '.cache', |
|
58 | 58 | serialize($this->currentObject), |
59 | 59 | $this->cacheTime |
60 | 60 | )) { |
61 | 61 | $this->__destruct(); |
62 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell '.$this->currentObjectID.' in APC'); |
|
62 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in APC'); |
|
63 | 63 | } |
64 | 64 | $this->currentCellIsDirty = false; |
65 | 65 | } |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | return true; |
108 | 108 | } |
109 | 109 | // Check if the requested entry still exists in apc |
110 | - $success = apc_fetch($this->cachePrefix.$pCoord.'.cache'); |
|
110 | + $success = apc_fetch($this->cachePrefix . $pCoord . '.cache'); |
|
111 | 111 | if ($success === false) { |
112 | 112 | // Entry no longer exists in APC, so clear it from the cache array |
113 | 113 | parent::deleteCacheData($pCoord); |
114 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); |
|
114 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache'); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | return true; |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | |
139 | 139 | // Check if the entry that has been requested actually exists |
140 | 140 | if (parent::isDataSet($pCoord)) { |
141 | - $obj = apc_fetch($this->cachePrefix.$pCoord.'.cache'); |
|
141 | + $obj = apc_fetch($this->cachePrefix . $pCoord . '.cache'); |
|
142 | 142 | if ($obj === false) { |
143 | 143 | // Entry no longer exists in APC, so clear it from the cache array |
144 | 144 | parent::deleteCacheData($pCoord); |
145 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); |
|
145 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache'); |
|
146 | 146 | } |
147 | 147 | } else { |
148 | 148 | // Return null if requested entry doesn't exist in cache |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | public function deleteCacheData($pCoord) |
184 | 184 | { |
185 | 185 | // Delete the entry from APC |
186 | - apc_delete($this->cachePrefix.$pCoord.'.cache'); |
|
186 | + apc_delete($this->cachePrefix . $pCoord . '.cache'); |
|
187 | 187 | |
188 | 188 | // Delete the entry from our cell address array |
189 | 189 | parent::deleteCacheData($pCoord); |
@@ -201,19 +201,19 @@ discard block |
||
201 | 201 | parent::copyCellCollection($parent); |
202 | 202 | // Get a new id for the new file name |
203 | 203 | $baseUnique = $this->getUniqueID(); |
204 | - $newCachePrefix = substr(md5($baseUnique), 0, 8).'.'; |
|
204 | + $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.'; |
|
205 | 205 | $cacheList = $this->getCellList(); |
206 | 206 | foreach ($cacheList as $cellID) { |
207 | 207 | if ($cellID != $this->currentObjectID) { |
208 | - $obj = apc_fetch($this->cachePrefix.$cellID.'.cache'); |
|
208 | + $obj = apc_fetch($this->cachePrefix . $cellID . '.cache'); |
|
209 | 209 | if ($obj === false) { |
210 | 210 | // Entry no longer exists in APC, so clear it from the cache array |
211 | 211 | parent::deleteCacheData($cellID); |
212 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry '.$cellID.' no longer exists in APC'); |
|
212 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $cellID . ' no longer exists in APC'); |
|
213 | 213 | } |
214 | - if (!apc_store($newCachePrefix.$cellID.'.cache', $obj, $this->cacheTime)) { |
|
214 | + if (!apc_store($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) { |
|
215 | 215 | $this->__destruct(); |
216 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell '.$cellID.' in APC'); |
|
216 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell ' . $cellID . ' in APC'); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | if ($this->cachePrefix === null) { |
253 | 253 | $baseUnique = $this->getUniqueID(); |
254 | - $this->cachePrefix = substr(md5($baseUnique), 0, 8).'.'; |
|
254 | + $this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.'; |
|
255 | 255 | $this->cacheTime = $cacheTime; |
256 | 256 | |
257 | 257 | parent::__construct($parent); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | { |
266 | 266 | $cacheList = $this->getCellList(); |
267 | 267 | foreach ($cacheList as $cellID) { |
268 | - apc_delete($this->cachePrefix.$cellID.'.cache'); |
|
268 | + apc_delete($this->cachePrefix . $cellID . '.cache'); |
|
269 | 269 | } |
270 | 270 | } |
271 | 271 |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | $this->currentObject->detach(); |
55 | 55 | |
56 | 56 | $obj = serialize($this->currentObject); |
57 | - if (wincache_ucache_exists($this->cachePrefix.$this->currentObjectID.'.cache')) { |
|
58 | - if (!wincache_ucache_set($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) { |
|
57 | + if (wincache_ucache_exists($this->cachePrefix . $this->currentObjectID . '.cache')) { |
|
58 | + if (!wincache_ucache_set($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) { |
|
59 | 59 | $this->__destruct(); |
60 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell '.$this->currentObjectID.' in WinCache'); |
|
60 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in WinCache'); |
|
61 | 61 | } |
62 | 62 | } else { |
63 | - if (!wincache_ucache_add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) { |
|
63 | + if (!wincache_ucache_add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) { |
|
64 | 64 | $this->__destruct(); |
65 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell '.$this->currentObjectID.' in WinCache'); |
|
65 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in WinCache'); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | $this->currentCellIsDirty = false; |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | return true; |
113 | 113 | } |
114 | 114 | // Check if the requested entry still exists in cache |
115 | - $success = wincache_ucache_exists($this->cachePrefix.$pCoord.'.cache'); |
|
115 | + $success = wincache_ucache_exists($this->cachePrefix . $pCoord . '.cache'); |
|
116 | 116 | if ($success === false) { |
117 | 117 | // Entry no longer exists in Wincache, so clear it from the cache array |
118 | 118 | parent::deleteCacheData($pCoord); |
119 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); |
|
119 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in WinCache'); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return true; |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | $obj = null; |
146 | 146 | if (parent::isDataSet($pCoord)) { |
147 | 147 | $success = false; |
148 | - $obj = wincache_ucache_get($this->cachePrefix.$pCoord.'.cache', $success); |
|
148 | + $obj = wincache_ucache_get($this->cachePrefix . $pCoord . '.cache', $success); |
|
149 | 149 | if ($success === false) { |
150 | 150 | // Entry no longer exists in WinCache, so clear it from the cache array |
151 | 151 | parent::deleteCacheData($pCoord); |
152 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); |
|
152 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in WinCache'); |
|
153 | 153 | } |
154 | 154 | } else { |
155 | 155 | // Return null if requested entry doesn't exist in cache |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | public function deleteCacheData($pCoord) |
191 | 191 | { |
192 | 192 | // Delete the entry from Wincache |
193 | - wincache_ucache_delete($this->cachePrefix.$pCoord.'.cache'); |
|
193 | + wincache_ucache_delete($this->cachePrefix . $pCoord . '.cache'); |
|
194 | 194 | |
195 | 195 | // Delete the entry from our cell address array |
196 | 196 | parent::deleteCacheData($pCoord); |
@@ -208,20 +208,20 @@ discard block |
||
208 | 208 | parent::copyCellCollection($parent); |
209 | 209 | // Get a new id for the new file name |
210 | 210 | $baseUnique = $this->getUniqueID(); |
211 | - $newCachePrefix = substr(md5($baseUnique), 0, 8).'.'; |
|
211 | + $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.'; |
|
212 | 212 | $cacheList = $this->getCellList(); |
213 | 213 | foreach ($cacheList as $cellID) { |
214 | 214 | if ($cellID != $this->currentObjectID) { |
215 | 215 | $success = false; |
216 | - $obj = wincache_ucache_get($this->cachePrefix.$cellID.'.cache', $success); |
|
216 | + $obj = wincache_ucache_get($this->cachePrefix . $cellID . '.cache', $success); |
|
217 | 217 | if ($success === false) { |
218 | 218 | // Entry no longer exists in WinCache, so clear it from the cache array |
219 | 219 | parent::deleteCacheData($cellID); |
220 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry '.$cellID.' no longer exists in Wincache'); |
|
220 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Cell entry ' . $cellID . ' no longer exists in Wincache'); |
|
221 | 221 | } |
222 | - if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->cacheTime)) { |
|
222 | + if (!wincache_ucache_add($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) { |
|
223 | 223 | $this->__destruct(); |
224 | - throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell '.$cellID.' in Wincache'); |
|
224 | + throw new \PhpOffice\PhpSpreadsheet\Exception('Failed to store cell ' . $cellID . ' in Wincache'); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | |
260 | 260 | if (is_null($this->cachePrefix)) { |
261 | 261 | $baseUnique = $this->getUniqueID(); |
262 | - $this->cachePrefix = substr(md5($baseUnique), 0, 8).'.'; |
|
262 | + $this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.'; |
|
263 | 263 | $this->cacheTime = $cacheTime; |
264 | 264 | |
265 | 265 | parent::__construct($parent); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | { |
274 | 274 | $cacheList = $this->getCellList(); |
275 | 275 | foreach ($cacheList as $cellID) { |
276 | - wincache_ucache_delete($this->cachePrefix.$cellID.'.cache'); |
|
276 | + wincache_ucache_delete($this->cachePrefix . $cellID . '.cache'); |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if ($this->currentCellIsDirty && !empty($this->currentObjectID)) { |
54 | 54 | $this->currentObject->detach(); |
55 | 55 | |
56 | - if (!$this->DBHandle->queryExec('INSERT OR REPLACE INTO kvp_'.$this->TableName." VALUES('".$this->currentObjectID."','".sqlite_escape_string(serialize($this->currentObject))."')")) { |
|
56 | + if (!$this->DBHandle->queryExec('INSERT OR REPLACE INTO kvp_' . $this->TableName . " VALUES('" . $this->currentObjectID . "','" . sqlite_escape_string(serialize($this->currentObject)) . "')")) { |
|
57 | 57 | throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError())); |
58 | 58 | } |
59 | 59 | $this->currentCellIsDirty = false; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | $this->storeData(); |
102 | 102 | |
103 | - $query = 'SELECT value FROM kvp_'.$this->TableName." WHERE id='".$pCoord."'"; |
|
103 | + $query = 'SELECT value FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'"; |
|
104 | 104 | $cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC); |
105 | 105 | if ($cellResultSet === false) { |
106 | 106 | throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError())); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | // Check if the requested entry exists in the cache |
140 | - $query = 'SELECT id FROM kvp_'.$this->TableName." WHERE id='".$pCoord."'"; |
|
140 | + $query = 'SELECT id FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'"; |
|
141 | 141 | $cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC); |
142 | 142 | if ($cellResultSet === false) { |
143 | 143 | throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError())); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | // Check if the requested entry exists in the cache |
167 | - $query = 'DELETE FROM kvp_'.$this->TableName." WHERE id='".$pCoord."'"; |
|
167 | + $query = 'DELETE FROM kvp_' . $this->TableName . " WHERE id='" . $pCoord . "'"; |
|
168 | 168 | if (!$this->DBHandle->queryExec($query)) { |
169 | 169 | throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError())); |
170 | 170 | } |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | $this->currentObjectID = $toAddress; |
189 | 189 | } |
190 | 190 | |
191 | - $query = 'DELETE FROM kvp_'.$this->TableName." WHERE id='".$toAddress."'"; |
|
191 | + $query = 'DELETE FROM kvp_' . $this->TableName . " WHERE id='" . $toAddress . "'"; |
|
192 | 192 | $result = $this->DBHandle->exec($query); |
193 | 193 | if ($result === false) { |
194 | 194 | throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg()); |
195 | 195 | } |
196 | 196 | |
197 | - $query = 'UPDATE kvp_'.$this->TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'"; |
|
197 | + $query = 'UPDATE kvp_' . $this->TableName . " SET id='" . $toAddress . "' WHERE id='" . $fromAddress . "'"; |
|
198 | 198 | $result = $this->DBHandle->exec($query); |
199 | 199 | if ($result === false) { |
200 | 200 | throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg()); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $this->storeData(); |
217 | 217 | } |
218 | 218 | |
219 | - $query = 'SELECT id FROM kvp_'.$this->TableName; |
|
219 | + $query = 'SELECT id FROM kvp_' . $this->TableName; |
|
220 | 220 | $cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC); |
221 | 221 | if ($cellIdsResult === false) { |
222 | 222 | throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError())); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | // Get a new id for the new table name |
246 | 246 | $tableName = str_replace('.', '_', $this->getUniqueID()); |
247 | - if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
247 | + if (!$this->DBHandle->queryExec('CREATE TABLE kvp_' . $tableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
248 | 248 | AS SELECT * FROM kvp_' .$this->TableName) |
249 | 249 | ) { |
250 | 250 | throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError())); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | if ($this->DBHandle === false) { |
289 | 289 | throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError())); |
290 | 290 | } |
291 | - if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { |
|
291 | + if (!$this->DBHandle->queryExec('CREATE TABLE kvp_' . $this->TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { |
|
292 | 292 | throw new \PhpOffice\PhpSpreadsheet\Exception(sqlite_error_string($this->DBHandle->lastError())); |
293 | 293 | } |
294 | 294 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | public function __destruct() |
301 | 301 | { |
302 | 302 | if (!is_null($this->DBHandle)) { |
303 | - $this->DBHandle->queryExec('DROP TABLE kvp_'.$this->TableName); |
|
303 | + $this->DBHandle->queryExec('DROP TABLE kvp_' . $this->TableName); |
|
304 | 304 | } |
305 | 305 | $this->DBHandle = null; |
306 | 306 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $this->storeData(); |
250 | 250 | } |
251 | 251 | |
252 | - $query = 'SELECT id FROM kvp_'.$this->TableName; |
|
252 | + $query = 'SELECT id FROM kvp_' . $this->TableName; |
|
253 | 253 | $cellIdsResult = $this->DBHandle->query($query); |
254 | 254 | if ($cellIdsResult === false) { |
255 | 255 | throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg()); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | // Get a new id for the new table name |
279 | 279 | $tableName = str_replace('.', '_', $this->getUniqueID()); |
280 | - if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
280 | + if (!$this->DBHandle->exec('CREATE TABLE kvp_' . $tableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
281 | 281 | AS SELECT * FROM kvp_' .$this->TableName) |
282 | 282 | ) { |
283 | 283 | throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg()); |
@@ -321,15 +321,15 @@ discard block |
||
321 | 321 | if ($this->DBHandle === false) { |
322 | 322 | throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg()); |
323 | 323 | } |
324 | - if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { |
|
324 | + if (!$this->DBHandle->exec('CREATE TABLE kvp_' . $this->TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { |
|
325 | 325 | throw new \PhpOffice\PhpSpreadsheet\Exception($this->DBHandle->lastErrorMsg()); |
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
329 | - $this->selectQuery = $this->DBHandle->prepare('SELECT value FROM kvp_'.$this->TableName.' WHERE id = :id'); |
|
330 | - $this->insertQuery = $this->DBHandle->prepare('INSERT OR REPLACE INTO kvp_'.$this->TableName.' VALUES(:id,:data)'); |
|
331 | - $this->updateQuery = $this->DBHandle->prepare('UPDATE kvp_'.$this->TableName.' SET id=:toId WHERE id=:fromId'); |
|
332 | - $this->deleteQuery = $this->DBHandle->prepare('DELETE FROM kvp_'.$this->TableName.' WHERE id = :id'); |
|
329 | + $this->selectQuery = $this->DBHandle->prepare('SELECT value FROM kvp_' . $this->TableName . ' WHERE id = :id'); |
|
330 | + $this->insertQuery = $this->DBHandle->prepare('INSERT OR REPLACE INTO kvp_' . $this->TableName . ' VALUES(:id,:data)'); |
|
331 | + $this->updateQuery = $this->DBHandle->prepare('UPDATE kvp_' . $this->TableName . ' SET id=:toId WHERE id=:fromId'); |
|
332 | + $this->deleteQuery = $this->DBHandle->prepare('DELETE FROM kvp_' . $this->TableName . ' WHERE id = :id'); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | public function __destruct() |
339 | 339 | { |
340 | 340 | if (!is_null($this->DBHandle)) { |
341 | - $this->DBHandle->exec('DROP TABLE kvp_'.$this->TableName); |
|
341 | + $this->DBHandle->exec('DROP TABLE kvp_' . $this->TableName); |
|
342 | 342 | $this->DBHandle->close(); |
343 | 343 | } |
344 | 344 | $this->DBHandle = null; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | parent::copyCellCollection($parent); |
152 | 152 | // Get a new id for the new file name |
153 | 153 | $baseUnique = $this->getUniqueID(); |
154 | - $newFileName = $this->cacheDirectory.'/PhpSpreadsheet.'.$baseUnique.'.cache'; |
|
154 | + $newFileName = $this->cacheDirectory . '/PhpSpreadsheet.' . $baseUnique . '.cache'; |
|
155 | 155 | // Copy the existing cell cache file |
156 | 156 | copy($this->fileName, $newFileName); |
157 | 157 | $this->fileName = $newFileName; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | parent::__construct($parent); |
193 | 193 | if (is_null($this->fileHandle)) { |
194 | 194 | $baseUnique = $this->getUniqueID(); |
195 | - $this->fileName = $this->cacheDirectory.'/PhpSpreadsheet.'.$baseUnique.'.cache'; |
|
195 | + $this->fileName = $this->cacheDirectory . '/PhpSpreadsheet.' . $baseUnique . '.cache'; |
|
196 | 196 | $this->fileHandle = fopen($this->fileName, 'a+'); |
197 | 197 | } |
198 | 198 | } |
@@ -187,7 +187,7 @@ |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | return md5( |
190 | - $hashElements. |
|
190 | + $hashElements . |
|
191 | 191 | __CLASS__ |
192 | 192 | ); |
193 | 193 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $condition = \PhpOffice\PhpSpreadsheet\Calculation::wrapResult(strtoupper($condition)); |
304 | 304 | } |
305 | 305 | |
306 | - return '='.$condition; |
|
306 | + return '=' . $condition; |
|
307 | 307 | } else { |
308 | 308 | preg_match('/([<>=]+)(.*)/', $condition, $matches); |
309 | 309 | list(, $operator, $operand) = $matches; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $operand = \PhpOffice\PhpSpreadsheet\Calculation::wrapResult(strtoupper($operand)); |
314 | 314 | } |
315 | 315 | |
316 | - return $operator.$operand; |
|
316 | + return $operator . $operand; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
@@ -653,10 +653,10 @@ discard block |
||
653 | 653 | foreach ($value as $k2 => $val) { |
654 | 654 | if (is_array($val)) { |
655 | 655 | foreach ($val as $k3 => $v) { |
656 | - $arrayValues[$k1.'.'.$k2.'.'.$k3] = $v; |
|
656 | + $arrayValues[$k1 . '.' . $k2 . '.' . $k3] = $v; |
|
657 | 657 | } |
658 | 658 | } else { |
659 | - $arrayValues[$k1.'.'.$k2] = $val; |
|
659 | + $arrayValues[$k1 . '.' . $k2] = $val; |
|
660 | 660 | } |
661 | 661 | } |
662 | 662 | } else { |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | $r = !is_array($replace) ? $replace : (isset($replace[$key]) ? $replace[$key] : ''); |
734 | 734 | $pos = mb_strpos($subject, $s, 0, 'UTF-8'); |
735 | 735 | while ($pos !== false) { |
736 | - $subject = mb_substr($subject, 0, $pos, 'UTF-8').$r.mb_substr($subject, $pos + mb_strlen($s, 'UTF-8'), null, 'UTF-8'); |
|
736 | + $subject = mb_substr($subject, 0, $pos, 'UTF-8') . $r . mb_substr($subject, $pos + mb_strlen($s, 'UTF-8'), null, 'UTF-8'); |
|
737 | 737 | $pos = mb_strpos($subject, $s, $pos + mb_strlen($r, 'UTF-8'), 'UTF-8'); |
738 | 738 | } |
739 | 739 | } |