@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getCreationDate() |
69 | 69 | { |
70 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
70 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
71 | 71 | return $this->creationDate; |
72 | - }else{ |
|
72 | + } else { |
|
73 | 73 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
74 | 74 | } |
75 | 75 | } |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function setCreationDate(\DateTimeInterface $date) |
83 | 83 | { |
84 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
84 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
85 | 85 | $this->creationDate = $date; |
86 | 86 | return $this; |
87 | - }else{ |
|
87 | + } else { |
|
88 | 88 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
89 | 89 | } |
90 | 90 | } |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getModificationDate() |
97 | 97 | { |
98 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
98 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
99 | 99 | return $this->modificationDate; |
100 | - }else{ |
|
100 | + } else { |
|
101 | 101 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
102 | 102 | } |
103 | 103 | } |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function setModificationDate(\DateTimeInterface $date) |
111 | 111 | { |
112 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
112 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
113 | 113 | $this->modificationDate = $date; |
114 | 114 | return $this; |
115 | - }else{ |
|
115 | + } else { |
|
116 | 116 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
117 | 117 | } |
118 | 118 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | public function removeTag($tagName) |
280 | 280 | { |
281 | 281 | if (($key = array_search($tagName, $this->tags)) !== false) { |
282 | - unset($this->tags[ $key ]); |
|
282 | + unset($this->tags[$key]); |
|
283 | 283 | $this->removedTags[] = $tagName; |
284 | 284 | } |
285 | 285 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | final public function __debugInfo() |
346 | 346 | { |
347 | 347 | $info = get_object_vars($this); |
348 | - $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')'; |
|
348 | + $info['driver'] = 'object(' . get_class($info['driver']) . ')'; |
|
349 | 349 | |
350 | 350 | return (array) $info; |
351 | 351 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | if($this->driver->getConfig()['itemDetailedDate']){ |
71 | 71 | return $this->creationDate; |
72 | - }else{ |
|
72 | + } else{ |
|
73 | 73 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
74 | 74 | } |
75 | 75 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if($this->driver->getConfig()['itemDetailedDate']){ |
85 | 85 | $this->creationDate = $date; |
86 | 86 | return $this; |
87 | - }else{ |
|
87 | + } else{ |
|
88 | 88 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
89 | 89 | } |
90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | { |
98 | 98 | if($this->driver->getConfig()['itemDetailedDate']){ |
99 | 99 | return $this->modificationDate; |
100 | - }else{ |
|
100 | + } else{ |
|
101 | 101 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
102 | 102 | } |
103 | 103 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if($this->driver->getConfig()['itemDetailedDate']){ |
113 | 113 | $this->modificationDate = $date; |
114 | 114 | return $this; |
115 | - }else{ |
|
115 | + } else{ |
|
116 | 116 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
117 | 117 | } |
118 | 118 | } |
@@ -159,9 +159,9 @@ |
||
159 | 159 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
160 | 160 | { |
161 | 161 | $wrap = [ |
162 | - self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
163 | - self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
164 | - self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
162 | + self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
163 | + self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
164 | + self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
165 | 165 | ]; |
166 | 166 | |
167 | 167 | if($this->config['itemDetailedDate']){ |
@@ -273,7 +273,7 @@ |
||
273 | 273 | |
274 | 274 | if (!is_dir($path)) { |
275 | 275 | throw new phpFastCacheDriverException("Can't read PATH:" . $path, 94); |
276 | - }else{ |
|
276 | + } else{ |
|
277 | 277 | $size = Directory::dirSize($path); |
278 | 278 | } |
279 | 279 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | if (is_array($config_name)) { |
53 | 53 | $this->config = array_merge($this->config, $config_name); |
54 | 54 | } else { |
55 | - $this->config[ $config_name ] = $value; |
|
55 | + $this->config[$config_name] = $value; |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -164,16 +164,16 @@ discard block |
||
164 | 164 | self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
165 | 165 | ]; |
166 | 166 | |
167 | - if($this->config['itemDetailedDate']){ |
|
168 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime(); |
|
167 | + if ($this->config['itemDetailedDate']) { |
|
168 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime(); |
|
169 | 169 | /** |
170 | 170 | * If the creation date exists |
171 | 171 | * reuse it else set a new Date |
172 | 172 | */ |
173 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime(); |
|
174 | - }else{ |
|
175 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null; |
|
176 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null; |
|
173 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime(); |
|
174 | + } else { |
|
175 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null; |
|
176 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | return $wrap; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function driverUnwrapData(array $wrapper) |
187 | 187 | { |
188 | - return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ]; |
|
188 | + return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX]; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function driverUnwrapTags(array $wrapper) |
196 | 196 | { |
197 | - return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ]; |
|
197 | + return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX]; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function driverUnwrapEdate(array $wrapper) |
206 | 206 | { |
207 | - return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ]; |
|
207 | + return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX]; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function driverUnwrapCdate(array $wrapper) |
215 | 215 | { |
216 | - return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ]; |
|
216 | + return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX]; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function driverUnwrapMdate(array $wrapper) |
225 | 225 | { |
226 | - return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ]; |
|
226 | + return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX]; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * on tags item, it can leads |
249 | 249 | * to an infinite recursive calls |
250 | 250 | */ |
251 | - if(strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX ) === 0){ |
|
251 | + if (strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX) === 0) { |
|
252 | 252 | throw new \LogicException('Trying to set tag(s) to an Tag item index: ' . $item->getKey()); |
253 | 253 | } |
254 | 254 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | foreach ($tagsItems as $tagsItem) { |
292 | 292 | $data = (array) $tagsItem->get(); |
293 | 293 | |
294 | - unset($data[ $item->getKey() ]); |
|
294 | + unset($data[$item->getKey()]); |
|
295 | 295 | $tagsItem->set($data); |
296 | 296 | |
297 | 297 | /** |
@@ -27,7 +27,7 @@ |
||
27 | 27 | return true; |
28 | 28 | } else if (constant($CONSTANT_NAME) !== $driverName) { |
29 | 29 | trigger_error('Memcache collision detected, you used both Memcache and Memcached driver in your script, this may leads to unexpected behaviours', |
30 | - E_USER_WARNING); |
|
30 | + E_USER_WARNING); |
|
31 | 31 | |
32 | 32 | return false; |
33 | 33 | } |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | $stm = $this->indexing->prepare("SELECT MAX(`db`) as `db` FROM `balancing`"); |
163 | 163 | $stm->execute(); |
164 | 164 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
165 | - if (!isset($row[ 'db' ])) { |
|
165 | + if (!isset($row['db'])) { |
|
166 | 166 | $db = 1; |
167 | - } elseif ($row[ 'db' ] <= 1) { |
|
167 | + } elseif ($row['db'] <= 1) { |
|
168 | 168 | $db = 1; |
169 | 169 | } else { |
170 | - $db = $row[ 'db' ]; |
|
170 | + $db = $row['db']; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // check file size |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | ':keyword' => $keyword, |
190 | 190 | ]); |
191 | 191 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
192 | - if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
|
193 | - $db = $row[ 'db' ]; |
|
192 | + if (isset($row['db']) && $row['db'] != '') { |
|
193 | + $db = $row['db']; |
|
194 | 194 | } else { |
195 | 195 | /* |
196 | 196 | * Insert new to Indexing |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | /** |
222 | 222 | * init instant |
223 | 223 | */ |
224 | - if (!isset($this->instance[ $instant ])) { |
|
224 | + if (!isset($this->instance[$instant])) { |
|
225 | 225 | // check DB Files ready or not |
226 | 226 | $createTable = false; |
227 | 227 | if (!file_exists($this->SqliteDir . '/db' . $instant) || $reset == true) { |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | $this->initDB($PDO); |
235 | 235 | } |
236 | 236 | |
237 | - $this->instance[ $instant ] = $PDO; |
|
237 | + $this->instance[$instant] = $PDO; |
|
238 | 238 | unset($PDO); |
239 | 239 | |
240 | 240 | } |
241 | 241 | |
242 | - return $this->instance[ $instant ]; |
|
242 | + return $this->instance[$instant]; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * Check for Cross-Driver type confusion |
254 | 254 | */ |
255 | 255 | if ($item instanceof Item) { |
256 | - $skipExisting = isset($this->config[ 'skipExisting' ]) ? $this->config[ 'skipExisting' ] : false; |
|
256 | + $skipExisting = isset($this->config['skipExisting']) ? $this->config['skipExisting'] : false; |
|
257 | 257 | $toWrite = true; |
258 | 258 | |
259 | 259 | // check in cache first |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
332 | - if (isset($row[ 'object' ])) { |
|
333 | - return $this->decode($row[ 'object' ]); |
|
332 | + if (isset($row['object'])) { |
|
333 | + return $this->decode($row['object']); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | return null; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
212 | - * @param $keyword |
|
212 | + * @param string $keyword |
|
213 | 213 | * @param bool $reset |
214 | 214 | * @return PDO |
215 | 215 | */ |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | /** |
248 | 248 | * @param \Psr\Cache\CacheItemInterface $item |
249 | - * @return mixed |
|
249 | + * @return boolean |
|
250 | 250 | * @throws \InvalidArgumentException |
251 | 251 | */ |
252 | 252 | protected function driverWrite(CacheItemInterface $item) |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE); |
155 | 155 | $PDO->setAttribute(PDO::ATTR_ERRMODE, |
156 | - PDO::ERRMODE_EXCEPTION); |
|
156 | + PDO::ERRMODE_EXCEPTION); |
|
157 | 157 | |
158 | 158 | if ($createTable == true) { |
159 | 159 | $this->initIndexing($PDO); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // look for keyword |
189 | 189 | $stm = $this->indexing->prepare("SELECT * FROM `balancing` WHERE `keyword`=:keyword LIMIT 1"); |
190 | 190 | $stm->execute([ |
191 | - ':keyword' => $keyword, |
|
191 | + ':keyword' => $keyword, |
|
192 | 192 | ]); |
193 | 193 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
194 | 194 | if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | $db = $this->currentDB; |
201 | 201 | $stm = $this->indexing->prepare("INSERT INTO `balancing` (`keyword`,`db`) VALUES(:keyword, :db)"); |
202 | 202 | $stm->execute([ |
203 | - ':keyword' => $keyword, |
|
204 | - ':db' => $db, |
|
203 | + ':keyword' => $keyword, |
|
204 | + ':db' => $db, |
|
205 | 205 | ]); |
206 | 206 | } |
207 | 207 | |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | if ($toWrite == true) { |
273 | 273 | try { |
274 | 274 | $stm = $this->getDb($item->getKey()) |
275 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
275 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
276 | 276 | $stm->execute([ |
277 | - ':keyword' => $item->getKey(), |
|
278 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
279 | - ':exp' => time() + $item->getTtl(), |
|
277 | + ':keyword' => $item->getKey(), |
|
278 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
279 | + ':exp' => time() + $item->getTtl(), |
|
280 | 280 | ]); |
281 | 281 | |
282 | 282 | return true; |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | |
285 | 285 | try { |
286 | 286 | $stm = $this->getDb($item->getKey(), true) |
287 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
287 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
288 | 288 | $stm->execute([ |
289 | - ':keyword' => $item->getKey(), |
|
290 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
291 | - ':exp' => time() + $item->getTtl(), |
|
289 | + ':keyword' => $item->getKey(), |
|
290 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
291 | + ':exp' => time() + $item->getTtl(), |
|
292 | 292 | ]); |
293 | 293 | } catch (PDOException $e) { |
294 | 294 | return false; |
@@ -310,20 +310,20 @@ discard block |
||
310 | 310 | { |
311 | 311 | try { |
312 | 312 | $stm = $this->getDb($item->getKey()) |
313 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
313 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
314 | 314 | $stm->execute([ |
315 | - ':keyword' => $item->getKey(), |
|
316 | - ':U' => time(), |
|
315 | + ':keyword' => $item->getKey(), |
|
316 | + ':U' => time(), |
|
317 | 317 | ]); |
318 | 318 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
319 | 319 | |
320 | 320 | } catch (PDOException $e) { |
321 | 321 | try { |
322 | 322 | $stm = $this->getDb($item->getKey(), true) |
323 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
323 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
324 | 324 | $stm->execute([ |
325 | - ':keyword' => $item->getKey(), |
|
326 | - ':U' => time(), |
|
325 | + ':keyword' => $item->getKey(), |
|
326 | + ':U' => time(), |
|
327 | 327 | ]); |
328 | 328 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
329 | 329 | } catch (PDOException $e) { |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | if ($item instanceof Item) { |
352 | 352 | try { |
353 | 353 | $stm = $this->getDb($item->getKey()) |
354 | - //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
|
355 | - ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
354 | + //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
|
355 | + ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
356 | 356 | |
357 | 357 | return $stm->execute([ |
358 | 358 | // ':id' => $row[ 'id' ], |
359 | - ':keyword' => $item->getKey(), |
|
360 | - ':U' => time(), |
|
359 | + ':keyword' => $item->getKey(), |
|
360 | + ':U' => time(), |
|
361 | 361 | ]); |
362 | 362 | } catch (PDOException $e) { |
363 | 363 | return false; |
@@ -42,10 +42,10 @@ |
||
42 | 42 | if (!is_object($driverInstance->getItem('test'))) { |
43 | 43 | echo '[FAIL] $driverInstance->getItem() returned an invalid var type:' . gettype($driverInstance) . "\n"; |
44 | 44 | $status = 1; |
45 | -}else if(!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)){ |
|
45 | +} else if (!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)) { |
|
46 | 46 | echo '[FAIL] $driverInstance->getItem() returned an invalid class that does not implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n"; |
47 | 47 | $status = 1; |
48 | -}else{ |
|
48 | +} else { |
|
49 | 49 | echo '[PASS] $driverInstance->getItem() returned a valid class that implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n"; |
50 | 50 | } |
51 | 51 |
@@ -42,10 +42,10 @@ |
||
42 | 42 | if (!is_object($driverInstance->getItem('test'))) { |
43 | 43 | echo '[FAIL] $driverInstance->getItem() returned an invalid var type:' . gettype($driverInstance) . "\n"; |
44 | 44 | $status = 1; |
45 | -}else if(!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)){ |
|
45 | +} else if(!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)){ |
|
46 | 46 | echo '[FAIL] $driverInstance->getItem() returned an invalid class that does not implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n"; |
47 | 47 | $status = 1; |
48 | -}else{ |
|
48 | +} else{ |
|
49 | 49 | echo '[PASS] $driverInstance->getItem() returned a valid class that implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n"; |
50 | 50 | } |
51 | 51 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | - * @return int|bool Return size in octet or false if no information available |
|
55 | + * @return string Return size in octet or false if no information available |
|
56 | 56 | */ |
57 | 57 | public function getSize() |
58 | 58 | { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * @return mixed |
|
63 | + * @return string |
|
64 | 64 | */ |
65 | 65 | public function getData() |
66 | 66 | { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * @param $info |
|
71 | + * @param string $info |
|
72 | 72 | * @return $this |
73 | 73 | */ |
74 | 74 | public function setInfo($info) |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | if (!is_object($driverInstance)) { |
25 | 25 | echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n"; |
26 | 26 | $status = 1; |
27 | -}else if(!($driverInstance instanceof CacheItemPoolInterface)){ |
|
27 | +} else if(!($driverInstance instanceof CacheItemPoolInterface)){ |
|
28 | 28 | echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n"; |
29 | 29 | $status = 1; |
30 | -}else{ |
|
30 | +} else{ |
|
31 | 31 | $key = 'test_attaching_detaching'; |
32 | 32 | |
33 | 33 | $itemDetached = $driverInstance->getItem($key); |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | if(!$driverInstance->isAttached($itemDetached)) |
38 | 38 | { |
39 | 39 | echo '[PASS] ExtendedCacheItemPoolInterface::isAttached() identified $itemDetached as being detached.' . "\n"; |
40 | - } |
|
41 | - else |
|
40 | + } else |
|
42 | 41 | { |
43 | 42 | echo '[FAIL] ExtendedCacheItemPoolInterface::isAttached() failed to identify $itemDetached as to be detached.' . "\n"; |
44 | 43 | $status = 1; |
@@ -48,7 +47,7 @@ discard block |
||
48 | 47 | $driverInstance->attachItem($itemDetached); |
49 | 48 | echo '[FAIL] ExtendedCacheItemPoolInterface::attachItem() attached $itemDetached without trowing an error.' . "\n"; |
50 | 49 | $status = 1; |
51 | - }catch(\LogicException $e){ |
|
50 | + } catch(\LogicException $e){ |
|
52 | 51 | echo '[PASS] ExtendedCacheItemPoolInterface::attachItem() failed to attach $itemDetached by trowing a LogicException exception.' . "\n"; |
53 | 52 | } |
54 | 53 |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | if (!is_object($driverInstance)) { |
25 | 25 | echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n"; |
26 | 26 | $status = 1; |
27 | -}else if(!($driverInstance instanceof CacheItemPoolInterface)){ |
|
27 | +} else if (!($driverInstance instanceof CacheItemPoolInterface)) { |
|
28 | 28 | echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n"; |
29 | 29 | $status = 1; |
30 | -}else{ |
|
30 | +} else { |
|
31 | 31 | $key = 'test_attaching_detaching'; |
32 | 32 | |
33 | 33 | $itemDetached = $driverInstance->getItem($key); |
34 | 34 | $driverInstance->detachItem($itemDetached); |
35 | 35 | $itemAttached = $driverInstance->getItem($key); |
36 | 36 | |
37 | - if($driverInstance->isAttached($itemDetached) !== true) |
|
37 | + if ($driverInstance->isAttached($itemDetached) !== true) |
|
38 | 38 | { |
39 | 39 | echo '[PASS] ExtendedCacheItemPoolInterface::isAttached() identified $itemDetached as being detached.' . "\n"; |
40 | 40 | } |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | $status = 1; |
45 | 45 | } |
46 | 46 | |
47 | - try{ |
|
47 | + try { |
|
48 | 48 | $driverInstance->attachItem($itemDetached); |
49 | 49 | echo '[FAIL] ExtendedCacheItemPoolInterface::attachItem() attached $itemDetached without trowing an error.' . "\n"; |
50 | 50 | $status = 1; |
51 | - }catch(\LogicException $e){ |
|
51 | + } catch (\LogicException $e) { |
|
52 | 52 | echo '[PASS] ExtendedCacheItemPoolInterface::attachItem() failed to attach $itemDetached by trowing a LogicException exception.' . "\n"; |
53 | 53 | } |
54 | 54 |
@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @param \Psr\Cache\CacheItemInterface $item |
60 | - * @return mixed |
|
60 | + * @return boolean |
|
61 | 61 | * @throws \InvalidArgumentException |
62 | 62 | */ |
63 | 63 | public function driverWrite(CacheItemInterface $item) |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | protected function driverRead(CacheItemInterface $item) |
80 | 80 | { |
81 | 81 | return [ |
82 | - self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
83 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
84 | - self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(), |
|
82 | + self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
83 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
84 | + self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(), |
|
85 | 85 | ]; |
86 | 86 | } |
87 | 87 | |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | { |
132 | 132 | $stat = new driverStatistic(); |
133 | 133 | $stat->setInfo('[Devtrue] A void info string') |
134 | - ->setSize(0) |
|
135 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
136 | - ->setRawData(true); |
|
134 | + ->setSize(0) |
|
135 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
136 | + ->setRawData(true); |
|
137 | 137 | |
138 | 138 | return $stat; |
139 | 139 | } |
@@ -133,8 +133,8 @@ |
||
133 | 133 | $stats = (array) zend_shm_cache_info(); |
134 | 134 | return (new driverStatistic()) |
135 | 135 | ->setData(implode(', ', array_keys($this->namespaces))) |
136 | - ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.",$stats[ 'items_total' ])) |
|
136 | + ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total'])) |
|
137 | 137 | ->setRawData($stats) |
138 | - ->setSize($stats[ 'memory_total' ]); |
|
138 | + ->setSize($stats['memory_total']); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | \ No newline at end of file |