@@ -77,7 +77,7 @@ |
||
| 77 | 77 | /** |
| 78 | 78 | * Skip if Existing Caching in Options |
| 79 | 79 | */ |
| 80 | - if ((bool) $this->config[ 'skipExisting' ] === true && file_exists($file_path)) { |
|
| 80 | + if ((bool) $this->config['skipExisting'] === true && file_exists($file_path)) { |
|
| 81 | 81 | $content = $this->readfile($file_path); |
| 82 | 82 | $old = $this->decode($content); |
| 83 | 83 | $toWrite = false; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $tmpFilename = realpath(dirname($file) . '/tmp_' . md5( |
| 112 | 112 | str_shuffle(uniqid($this->getDriverName(), false)) |
| 113 | 113 | . str_shuffle(uniqid($this->getDriverName(), false)) |
| 114 | - )); |
|
| 114 | + )); |
|
| 115 | 115 | |
| 116 | 116 | $f = fopen($tmpFilename, 'w+'); |
| 117 | 117 | flock($f, LOCK_EX); |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
| 197 | 197 | { |
| 198 | 198 | $wrap = [ |
| 199 | - self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
| 200 | - self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
| 201 | - self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
| 199 | + self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
| 200 | + self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
| 201 | + self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
| 202 | 202 | ]; |
| 203 | 203 | |
| 204 | 204 | if($this->config['itemDetailedDate']){ |
@@ -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 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | $this->eventManager->dispatch('CacheWriteFileOnDisk', $this, $file, $secureFileManipulation); |
| 109 | 109 | |
| 110 | - if($secureFileManipulation){ |
|
| 110 | + if ($secureFileManipulation) { |
|
| 111 | 111 | $tmpFilename = realpath(dirname($file) . '/tmp_' . md5( |
| 112 | 112 | str_shuffle(uniqid($this->getDriverName(), false)) |
| 113 | 113 | . str_shuffle(uniqid($this->getDriverName(), false)) |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | flock($f, LOCK_UN); |
| 120 | 120 | fclose($f); |
| 121 | 121 | rename($tmpFilename, $file); |
| 122 | - }else{ |
|
| 122 | + } else { |
|
| 123 | 123 | $f = fopen($file, 'w+'); |
| 124 | 124 | $octetWritten = fwrite($f, $data); |
| 125 | 125 | fclose($f); |
@@ -201,16 +201,16 @@ discard block |
||
| 201 | 201 | self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
| 202 | 202 | ]; |
| 203 | 203 | |
| 204 | - if($this->config['itemDetailedDate']){ |
|
| 205 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime(); |
|
| 204 | + if ($this->config['itemDetailedDate']) { |
|
| 205 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime(); |
|
| 206 | 206 | /** |
| 207 | 207 | * If the creation date exists |
| 208 | 208 | * reuse it else set a new Date |
| 209 | 209 | */ |
| 210 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime(); |
|
| 211 | - }else{ |
|
| 212 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null; |
|
| 213 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null; |
|
| 210 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime(); |
|
| 211 | + } else { |
|
| 212 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null; |
|
| 213 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null; |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | return $wrap; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function driverUnwrapData(array $wrapper) |
| 224 | 224 | { |
| 225 | - return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ]; |
|
| 225 | + return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX]; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public function driverUnwrapTags(array $wrapper) |
| 233 | 233 | { |
| 234 | - return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ]; |
|
| 234 | + return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX]; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function driverUnwrapEdate(array $wrapper) |
| 243 | 243 | { |
| 244 | - return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ]; |
|
| 244 | + return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX]; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public function driverUnwrapCdate(array $wrapper) |
| 252 | 252 | { |
| 253 | - return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ]; |
|
| 253 | + return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX]; |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function driverUnwrapMdate(array $wrapper) |
| 262 | 262 | { |
| 263 | - return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ]; |
|
| 263 | + return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX]; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * on tags item, it can leads |
| 286 | 286 | * to an infinite recursive calls |
| 287 | 287 | */ |
| 288 | - if(strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX ) === 0){ |
|
| 288 | + if (strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX) === 0) { |
|
| 289 | 289 | throw new \LogicException('Trying to set tag(s) to an Tag item index: ' . $item->getKey()); |
| 290 | 290 | } |
| 291 | 291 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | foreach ($tagsItems as $tagsItem) { |
| 329 | 329 | $data = (array) $tagsItem->get(); |
| 330 | 330 | |
| 331 | - unset($data[ $item->getKey() ]); |
|
| 331 | + unset($data[$item->getKey()]); |
|
| 332 | 332 | $tagsItem->set($data); |
| 333 | 333 | |
| 334 | 334 | /** |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | flock($f, LOCK_UN); |
| 120 | 120 | fclose($f); |
| 121 | 121 | rename($tmpFilename, $file); |
| 122 | - }else{ |
|
| 122 | + } else{ |
|
| 123 | 123 | $f = fopen($file, 'w+'); |
| 124 | 124 | $octetWritten = fwrite($f, $data); |
| 125 | 125 | fclose($f); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * reuse it else set a new Date |
| 209 | 209 | */ |
| 210 | 210 | $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime(); |
| 211 | - }else{ |
|
| 211 | + } else{ |
|
| 212 | 212 | $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null; |
| 213 | 213 | $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null; |
| 214 | 214 | } |