@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * Check for Cross-Driver type confusion |
| 85 | 85 | */ |
| 86 | 86 | if ($item instanceof Item) { |
| 87 | - return (bool)$this->instance->set($item->getKey(), $this->encode($this->driverPreWrap($item))); |
|
| 87 | + return (bool) $this->instance->set($item->getKey(), $this->encode($this->driverPreWrap($item))); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $this->instance->close(); |
| 117 | 117 | $this->instance = null; |
| 118 | 118 | } |
| 119 | - $result = (bool)LeveldbClient::destroy($this->getLeveldbFile()); |
|
| 119 | + $result = (bool) LeveldbClient::destroy($this->getLeveldbFile()); |
|
| 120 | 120 | $this->driverConnect(); |
| 121 | 121 | |
| 122 | 122 | return $result; |
@@ -89,8 +89,7 @@ discard block |
||
| 89 | 89 | return \unlink($source); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $files = new RecursiveIteratorIterator |
|
| 93 | - ( |
|
| 92 | + $files = new RecursiveIteratorIterator( |
|
| 94 | 93 | new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
| 95 | 94 | RecursiveIteratorIterator::CHILD_FIRST |
| 96 | 95 | ); |
@@ -142,7 +141,7 @@ discard block |
||
| 142 | 141 | /** |
| 143 | 142 | * Allows to dereference char |
| 144 | 143 | */ |
| 145 | - $__FILE__ = \preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__);// remove file protocols such as "phar://" etc. |
|
| 144 | + $__FILE__ = \preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__); // remove file protocols such as "phar://" etc. |
|
| 146 | 145 | $prefix = $__FILE__[0] === \DIRECTORY_SEPARATOR ? \DIRECTORY_SEPARATOR : ''; |
| 147 | 146 | return $prefix . \implode(\DIRECTORY_SEPARATOR, $absolutes); |
| 148 | 147 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | /** |
| 28 | 28 | * Register Autoload |
| 29 | 29 | */ |
| 30 | -\spl_autoload_register(function ($entity) { |
|
| 30 | +\spl_autoload_register(function($entity) { |
|
| 31 | 31 | $module = \explode('\\', $entity, 2); |
| 32 | 32 | if (!\in_array($module[0], ['Phpfastcache', 'Psr'])) { |
| 33 | 33 | /** |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $this->data[] = $data; |
| 283 | 283 | } else { |
| 284 | 284 | if (\is_string($data)) { |
| 285 | - $this->data .= (string)$data; |
|
| 285 | + $this->data .= (string) $data; |
|
| 286 | 286 | } else { |
| 287 | 287 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
| 288 | 288 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | \array_unshift($this->data, $data); |
| 304 | 304 | } else { |
| 305 | 305 | if (\is_string($data)) { |
| 306 | - $this->data = (string)$data . $this->data; |
|
| 306 | + $this->data = (string) $data . $this->data; |
|
| 307 | 307 | } else { |
| 308 | 308 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
| 309 | 309 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | if ($item instanceof Item) { |
| 115 | 115 | try { |
| 116 | - return (bool)$this->getBucket()->upsert( |
|
| 116 | + return (bool) $this->getBucket()->upsert( |
|
| 117 | 117 | $item->getEncodedKey(), |
| 118 | 118 | $this->encode($this->driverPreWrap($item)), |
| 119 | 119 | ['expiry' => $item->getTtl()] |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | if ($item instanceof Item) { |
| 140 | 140 | try { |
| 141 | - return (bool)$this->getBucket()->remove($item->getEncodedKey()); |
|
| 141 | + return (bool) $this->getBucket()->remove($item->getEncodedKey()); |
|
| 142 | 142 | } catch (\Couchbase\Exception $e) { |
| 143 | 143 | return $e->getCode() === COUCHBASE_KEY_ENOENT; |
| 144 | 144 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | if ($item instanceof Item) { |
| 90 | 90 | $ttl = $item->getExpirationDate()->getTimestamp() - \time(); |
| 91 | 91 | |
| 92 | - return (bool)apc_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
| 92 | + return (bool) apc_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * Check for Cross-Driver type confusion |
| 107 | 107 | */ |
| 108 | 108 | if ($item instanceof Item) { |
| 109 | - return (bool)apc_delete($item->getKey()); |
|
| 109 | + return (bool) apc_delete($item->getKey()); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function getStats(): DriverStatistic |
| 133 | 133 | { |
| 134 | - $stats = (array)apc_cache_info('user'); |
|
| 134 | + $stats = (array) apc_cache_info('user'); |
|
| 135 | 135 | $date = (new \DateTime())->setTimestamp($stats['start_time']); |
| 136 | 136 | |
| 137 | 137 | return (new DriverStatistic()) |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | * Check for Cross-Driver type confusion |
| 95 | 95 | */ |
| 96 | 96 | if ($item instanceof Item) { |
| 97 | - return (bool)zend_disk_cache_delete($item->getKey()); |
|
| 97 | + return (bool) zend_disk_cache_delete($item->getKey()); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * Check for Cross-Driver type confusion |
| 95 | 95 | */ |
| 96 | 96 | if ($item instanceof Item) { |
| 97 | - return (bool)zend_shm_cache_delete($item->getKey()); |
|
| 97 | + return (bool) zend_shm_cache_delete($item->getKey()); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function getStats(): DriverStatistic |
| 133 | 133 | { |
| 134 | - $stats = (array)zend_shm_cache_info(); |
|
| 134 | + $stats = (array) zend_shm_cache_info(); |
|
| 135 | 135 | return (new DriverStatistic()) |
| 136 | 136 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 137 | 137 | ->setInfo(\sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total'])) |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | if (!isset($this->tmp[$full_path_hash]) || (!@\file_exists($full_path) || !@\is_writable($full_path))) { |
| 106 | 106 | if (!@\file_exists($full_path)) { |
| 107 | - if (@mkdir($full_path, $this->getDefaultChmod(), true) === false && !\is_dir($full_path) ) { |
|
| 108 | - throw new PhpfastcacheIOException('The directory '.$full_path.' could not be created.'); |
|
| 107 | + if (@mkdir($full_path, $this->getDefaultChmod(), true) === false && !\is_dir($full_path)) { |
|
| 108 | + throw new PhpfastcacheIOException('The directory ' . $full_path . ' could not be created.'); |
|
| 109 | 109 | } |
| 110 | 110 | } else { |
| 111 | 111 | if (!@\is_writable($full_path)) { |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | $full_path = $full_path_tmp; |
| 118 | 118 | if (!@\file_exists($full_path)) { |
| 119 | - if(@mkdir($full_path, $this->getDefaultChmod(), true) && !\is_dir($full_path)){ |
|
| 120 | - throw new PhpfastcacheIOException('The directory '.$full_path.' could not be created.'); |
|
| 119 | + if (@mkdir($full_path, $this->getDefaultChmod(), true) && !\is_dir($full_path)) { |
|
| 120 | + throw new PhpfastcacheIOException('The directory ' . $full_path . ' could not be created.'); |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | )); |
| 300 | 300 | |
| 301 | 301 | $f = \fopen($tmpFilename, 'w+b'); |
| 302 | - if(\is_resource($f)){ |
|
| 302 | + if (\is_resource($f)) { |
|
| 303 | 303 | \flock($f, \LOCK_EX); |
| 304 | 304 | $octetWritten = fwrite($f, $data); |
| 305 | 305 | \flock($f, \LOCK_UN); |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | } |
| 312 | 312 | } else { |
| 313 | 313 | $f = \fopen($file, 'w+b'); |
| 314 | - if(\is_resource($f)){ |
|
| 314 | + if (\is_resource($f)) { |
|
| 315 | 315 | $octetWritten = \fwrite($f, $data); |
| 316 | 316 | \fclose($f); |
| 317 | 317 | } |