@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | * due to performance issue on huge |
| 76 | 76 | * loop dispatching operations |
| 77 | 77 | */ |
| 78 | - if (isset($this->events[ $eventName ])) { |
|
| 79 | - foreach ($this->events[ $eventName ] as $event) { |
|
| 78 | + if (isset($this->events[$eventName])) { |
|
| 79 | + foreach ($this->events[$eventName] as $event) { |
|
| 80 | 80 | call_user_func_array($event, $args); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | if (strpos($name, 'on') === 0) { |
| 94 | 94 | $name = substr($name, 2); |
| 95 | - if (is_callable($arguments[ 0 ])) { |
|
| 96 | - if (isset($arguments[ 1 ]) && is_string($arguments[ 0 ])) { |
|
| 97 | - $this->events[ $name ][ $arguments[ 1 ] ] = $arguments[ 0 ]; |
|
| 95 | + if (is_callable($arguments[0])) { |
|
| 96 | + if (isset($arguments[1]) && is_string($arguments[0])) { |
|
| 97 | + $this->events[$name][$arguments[1]] = $arguments[0]; |
|
| 98 | 98 | } else { |
| 99 | - $this->events[ $name ][] = $arguments[ 0 ]; |
|
| 99 | + $this->events[$name][] = $arguments[0]; |
|
| 100 | 100 | } |
| 101 | 101 | } else { |
| 102 | - throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[ 0 ]))); |
|
| 102 | + throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[0]))); |
|
| 103 | 103 | } |
| 104 | 104 | } else { |
| 105 | 105 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function unbindEventCallback($eventName, $callbackName) |
| 115 | 115 | { |
| 116 | - if (isset($this->events[ $eventName ][ $callbackName ])) { |
|
| 117 | - unset($this->events[ $eventName ][ $callbackName ]); |
|
| 116 | + if (isset($this->events[$eventName][$callbackName])) { |
|
| 117 | + unset($this->events[$eventName][$callbackName]); |
|
| 118 | 118 | return true; |
| 119 | 119 | } |
| 120 | 120 | return false; |
@@ -139,9 +139,9 @@ |
||
| 139 | 139 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
| 140 | 140 | { |
| 141 | 141 | $wrap = [ |
| 142 | - self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
| 143 | - self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
| 144 | - self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
| 142 | + self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
| 143 | + self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
| 144 | + self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
| 145 | 145 | ]; |
| 146 | 146 | |
| 147 | 147 | if ($this->config[ 'itemDetailedDate' ]) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if (is_array($config_name)) { |
| 60 | 60 | $this->config = array_merge($this->config, $config_name); |
| 61 | 61 | } else { |
| 62 | - $this->config[ $config_name ] = $value; |
|
| 62 | + $this->config[$config_name] = $value; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function getConfigOption($optionName) |
| 79 | 79 | { |
| 80 | - if (isset($this->config[ $optionName ])) { |
|
| 81 | - return $this->config[ $optionName ]; |
|
| 80 | + if (isset($this->config[$optionName])) { |
|
| 81 | + return $this->config[$optionName]; |
|
| 82 | 82 | } else { |
| 83 | 83 | return null; |
| 84 | 84 | } |
@@ -149,16 +149,16 @@ discard block |
||
| 149 | 149 | self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
| 150 | 150 | ]; |
| 151 | 151 | |
| 152 | - if ($this->config[ 'itemDetailedDate' ]) { |
|
| 153 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime(); |
|
| 152 | + if ($this->config['itemDetailedDate']) { |
|
| 153 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime(); |
|
| 154 | 154 | /** |
| 155 | 155 | * If the creation date exists |
| 156 | 156 | * reuse it else set a new Date |
| 157 | 157 | */ |
| 158 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime(); |
|
| 158 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime(); |
|
| 159 | 159 | } else { |
| 160 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null; |
|
| 161 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null; |
|
| 160 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null; |
|
| 161 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | return $wrap; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function driverUnwrapData(array $wrapper) |
| 172 | 172 | { |
| 173 | - return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ]; |
|
| 173 | + return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX]; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function driverUnwrapTags(array $wrapper) |
| 181 | 181 | { |
| 182 | - return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ]; |
|
| 182 | + return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX]; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function driverUnwrapEdate(array $wrapper) |
| 191 | 191 | { |
| 192 | - return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ]; |
|
| 192 | + return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX]; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function driverUnwrapCdate(array $wrapper) |
| 200 | 200 | { |
| 201 | - return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ]; |
|
| 201 | + return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX]; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function driverUnwrapMdate(array $wrapper) |
| 210 | 210 | { |
| 211 | - return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ]; |
|
| 211 | + return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX]; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function getDriverName() |
| 218 | 218 | { |
| 219 | - if(!$this->driverName){ |
|
| 219 | + if (!$this->driverName) { |
|
| 220 | 220 | $this->driverName = ucfirst(substr(strrchr((new \ReflectionObject($this))->getNamespaceName(), '\\'), 1)); |
| 221 | 221 | } |
| 222 | 222 | return $this->driverName; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | throw new phpFastCacheLogicException('Trying to set tag(s) to an Tag item index: ' . $item->getKey()); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if(!$item->getTags() && !$item->getRemovedTags()) |
|
| 241 | + if (!$item->getTags() && !$item->getRemovedTags()) |
|
| 242 | 242 | { |
| 243 | 243 | return true; |
| 244 | 244 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * that has slow performances |
| 259 | 259 | */ |
| 260 | 260 | |
| 261 | - $tagsItem->set(array_merge((array)$data, [$item->getKey() => $expTimestamp])); |
|
| 261 | + $tagsItem->set(array_merge((array) $data, [$item->getKey() => $expTimestamp])); |
|
| 262 | 262 | |
| 263 | 263 | /** |
| 264 | 264 | * Set the expiration date |
@@ -280,9 +280,9 @@ discard block |
||
| 280 | 280 | $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags())); |
| 281 | 281 | |
| 282 | 282 | foreach ($tagsItems as $tagsItem) { |
| 283 | - $data = (array)$tagsItem->get(); |
|
| 283 | + $data = (array) $tagsItem->get(); |
|
| 284 | 284 | |
| 285 | - unset($data[ $item->getKey() ]); |
|
| 285 | + unset($data[$item->getKey()]); |
|
| 286 | 286 | $tagsItem->set($data); |
| 287 | 287 | |
| 288 | 288 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getCreationDate() |
| 113 | 113 | { |
| 114 | - if ($this->driver->getConfig()[ 'itemDetailedDate' ]) { |
|
| 114 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
| 115 | 115 | return $this->creationDate; |
| 116 | 116 | } else { |
| 117 | 117 | throw new phpFastCacheLogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function setCreationDate(\DateTimeInterface $date) |
| 127 | 127 | { |
| 128 | - if ($this->driver->getConfig()[ 'itemDetailedDate' ]) { |
|
| 128 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
| 129 | 129 | $this->creationDate = $date; |
| 130 | 130 | return $this; |
| 131 | 131 | } else { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function getModificationDate() |
| 141 | 141 | { |
| 142 | - if ($this->driver->getConfig()[ 'itemDetailedDate' ]) { |
|
| 142 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
| 143 | 143 | return $this->modificationDate; |
| 144 | 144 | } else { |
| 145 | 145 | throw new phpFastCacheLogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function setModificationDate(\DateTimeInterface $date) |
| 155 | 155 | { |
| 156 | - if ($this->driver->getConfig()[ 'itemDetailedDate' ]) { |
|
| 156 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
| 157 | 157 | $this->modificationDate = $date; |
| 158 | 158 | return $this; |
| 159 | 159 | } else { |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | if (is_array($this->data)) { |
| 227 | 227 | $this->data[] = $data; |
| 228 | 228 | } else if (is_string($data)) { |
| 229 | - $this->data .= (string)$data; |
|
| 229 | + $this->data .= (string) $data; |
|
| 230 | 230 | } else { |
| 231 | 231 | throw new phpFastCacheInvalidArgumentException('$data must be either array nor string.'); |
| 232 | 232 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | if (is_array($this->data)) { |
| 246 | 246 | array_unshift($this->data, $data); |
| 247 | 247 | } else if (is_string($data)) { |
| 248 | - $this->data = (string)$data . $this->data; |
|
| 248 | + $this->data = (string) $data . $this->data; |
|
| 249 | 249 | } else { |
| 250 | 250 | throw new phpFastCacheInvalidArgumentException('$data must be either array nor string.'); |
| 251 | 251 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | public function removeTag($tagName) |
| 325 | 325 | { |
| 326 | 326 | if (($key = array_search($tagName, $this->tags)) !== false) { |
| 327 | - unset($this->tags[ $key ]); |
|
| 327 | + unset($this->tags[$key]); |
|
| 328 | 328 | $this->removedTags[] = $tagName; |
| 329 | 329 | } |
| 330 | 330 | |
@@ -403,8 +403,8 @@ discard block |
||
| 403 | 403 | final public function __debugInfo() |
| 404 | 404 | { |
| 405 | 405 | $info = get_object_vars($this); |
| 406 | - $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')'; |
|
| 406 | + $info['driver'] = 'object(' . get_class($info['driver']) . ')'; |
|
| 407 | 407 | |
| 408 | - return (array)$info; |
|
| 408 | + return (array) $info; |
|
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | \ No newline at end of file |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function __construct() |
| 38 | 38 | { |
| 39 | - $this->instances =& CacheManager::getInternalInstances(); |
|
| 39 | + $this->instances = & CacheManager::getInternalInstances(); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function getGenericCallback() |
| 46 | 46 | { |
| 47 | - return function ($method, $args) { |
|
| 47 | + return function($method, $args) { |
|
| 48 | 48 | $getterMethod = (strpos($method, 'get') === 0); |
| 49 | 49 | $return = false; |
| 50 | 50 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | foreach ($this->instances as $instance) { |
| 56 | 56 | $reflectionMethod = new \ReflectionMethod(get_class($instance), $method); |
| 57 | 57 | if ($getterMethod) { |
| 58 | - $return[ $instance->getDriverName() ] = $reflectionMethod->invokeArgs($instance, $args); |
|
| 58 | + $return[$instance->getDriverName()] = $reflectionMethod->invokeArgs($instance, $args); |
|
| 59 | 59 | } else { |
| 60 | 60 | $result = $reflectionMethod->invokeArgs($instance, $args); |
| 61 | 61 | if ($result !== false) { |
@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
| 134 | 134 | if (count($servers) < 1) { |
| 135 | 135 | $servers = [ |
| 136 | - [ |
|
| 136 | + [ |
|
| 137 | 137 | 'host' => '127.0.0.1', |
| 138 | 138 | 'port' => 11211, |
| 139 | 139 | 'sasl_user' => false, |
| 140 | 140 | 'sasl_password' => false, |
| 141 | - ], |
|
| 141 | + ], |
|
| 142 | 142 | ]; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
| 176 | 176 | |
| 177 | 177 | return (new DriverStatistic()) |
| 178 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 179 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 180 | - ->setRawData($stats) |
|
| 181 | - ->setSize($stats[ 'bytes' ]); |
|
| 178 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 179 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 180 | + ->setRawData($stats) |
|
| 181 | + ->setSize($stats[ 'bytes' ]); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | \ No newline at end of file |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | - * @return bool |
|
| 129 | + * @return boolean|null |
|
| 130 | 130 | */ |
| 131 | 131 | protected function driverConnect() |
| 132 | 132 | { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $this->instance = new MemcachedSoftware(); |
| 134 | 134 | $this->instance->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); |
| 135 | - $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
|
| 135 | + $servers = (!empty($this->config['servers']) && is_array($this->config['servers']) ? $this->config['servers'] : []); |
|
| 136 | 136 | if (count($servers) < 1) { |
| 137 | 137 | $servers = [ |
| 138 | 138 | [ |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | foreach ($servers as $server) { |
| 148 | 148 | try { |
| 149 | - if (!$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 149 | + if (!$this->instance->addServer($server['host'], $server['port'])) { |
|
| 150 | 150 | $this->fallback = true; |
| 151 | 151 | } |
| 152 | - if (!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password' ])) { |
|
| 153 | - $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password' ]); |
|
| 152 | + if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) { |
|
| 153 | + $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']); |
|
| 154 | 154 | } |
| 155 | 155 | } catch (\Exception $e) { |
| 156 | 156 | $this->fallback = true; |
@@ -170,16 +170,16 @@ discard block |
||
| 170 | 170 | public function getStats() |
| 171 | 171 | { |
| 172 | 172 | $stats = current($this->instance->getStats()); |
| 173 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
| 174 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : $this->instance->getVersion()); |
|
| 175 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
| 173 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
| 174 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : $this->instance->getVersion()); |
|
| 175 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
| 176 | 176 | |
| 177 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
| 177 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
| 178 | 178 | |
| 179 | 179 | return (new DriverStatistic()) |
| 180 | 180 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 181 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 181 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
| 182 | 182 | ->setRawData($stats) |
| 183 | - ->setSize($stats[ 'bytes' ]); |
|
| 183 | + ->setSize($stats['bytes']); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | \ No newline at end of file |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $keyword = self::PREFIX . $item->getKey(); |
| 82 | 82 | $v = json_encode($this->driverPreWrap($item)); |
| 83 | 83 | |
| 84 | - if (isset($this->config[ 'limited_memory_each_object' ]) && strlen($v) > $this->config[ 'limited_memory_each_object' ]) { |
|
| 84 | + if (isset($this->config['limited_memory_each_object']) && strlen($v) > $this->config['limited_memory_each_object']) { |
|
| 85 | 85 | return false; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $this->driverConnect(); |
| 102 | 102 | $keyword = self::PREFIX . $item->getKey(); |
| 103 | - $x = isset($_COOKIE[ $keyword ]) ? json_decode($_COOKIE[ $keyword ], true) : false; |
|
| 103 | + $x = isset($_COOKIE[$keyword]) ? json_decode($_COOKIE[$keyword], true) : false; |
|
| 104 | 104 | |
| 105 | 105 | if ($x == false) { |
| 106 | 106 | return null; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | $this->driverConnect(); |
| 123 | 123 | $keyword = self::PREFIX . $key; |
| 124 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ])->t) : false; |
|
| 124 | + $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword])->t) : false; |
|
| 125 | 125 | |
| 126 | 126 | return $x ? $x - time() : $x; |
| 127 | 127 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | if ($item instanceof Item) { |
| 140 | 140 | $this->driverConnect(); |
| 141 | 141 | $keyword = self::PREFIX . $item->getKey(); |
| 142 | - $_COOKIE[ $keyword ] = null; |
|
| 142 | + $_COOKIE[$keyword] = null; |
|
| 143 | 143 | |
| 144 | 144 | return @setcookie($keyword, null, -10); |
| 145 | 145 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $this->driverConnect(); |
| 157 | 157 | foreach ($_COOKIE as $keyword => $value) { |
| 158 | 158 | if (strpos($keyword, self::PREFIX) !== false) { |
| 159 | - $_COOKIE[ $keyword ] = null; |
|
| 159 | + $_COOKIE[$keyword] = null; |
|
| 160 | 160 | $result = @setcookie($keyword, null, -10); |
| 161 | 161 | if ($return !== false) { |
| 162 | 162 | $return = $result; |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
| 142 | 142 | $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
| 143 | 143 | $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
| 144 | - [ |
|
| 144 | + [ |
|
| 145 | 145 | 'bucket' => 'default', |
| 146 | 146 | 'password' => '', |
| 147 | - ], |
|
| 147 | + ], |
|
| 148 | 148 | ]; |
| 149 | 149 | |
| 150 | 150 | $this->instance = new CouchbaseClient("couchbase://{$host}:{$port}", $username, $password); |
@@ -194,10 +194,10 @@ discard block |
||
| 194 | 194 | $info = $this->getBucket()->manager()->info(); |
| 195 | 195 | |
| 196 | 196 | return (new DriverStatistic()) |
| 197 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 198 | - ->setRawData($info) |
|
| 199 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 200 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 201 | - 1) . "\n For more information see RawData."); |
|
| 197 | + ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 198 | + ->setRawData($info) |
|
| 199 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 200 | + ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 201 | + 1) . "\n For more information see RawData."); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | \ No newline at end of file |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * @param \Psr\Cache\CacheItemInterface $item |
| 65 | - * @return mixed |
|
| 65 | + * @return boolean |
|
| 66 | 66 | * @throws phpFastCacheInvalidArgumentException |
| 67 | 67 | */ |
| 68 | 68 | protected function driverWrite(CacheItemInterface $item) |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | if ($item instanceof Item) { |
| 81 | 81 | try { |
| 82 | - return (bool)$this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]); |
|
| 82 | + return (bool) $this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]); |
|
| 83 | 83 | } catch (\CouchbaseException $e) { |
| 84 | 84 | return false; |
| 85 | 85 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | if ($item instanceof Item) { |
| 118 | 118 | try { |
| 119 | - return (bool)$this->getBucket()->remove($item->getEncodedKey()); |
|
| 119 | + return (bool) $this->getBucket()->remove($item->getEncodedKey()); |
|
| 120 | 120 | } catch (\Couchbase\Exception $e) { |
| 121 | 121 | return $e->getCode() === COUCHBASE_KEY_ENOENT; |
| 122 | 122 | } |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | } else { |
| 145 | 145 | |
| 146 | 146 | |
| 147 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 148 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 8091; |
|
| 149 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 150 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
| 151 | - $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
|
| 147 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 148 | + $port = isset($this->config['port']) ? $this->config['port'] : 8091; |
|
| 149 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 150 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
| 151 | + $buckets = isset($this->config['buckets']) ? $this->config['buckets'] : [ |
|
| 152 | 152 | [ |
| 153 | 153 | 'bucket' => 'default', |
| 154 | 154 | 'password' => '', |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | $this->instance = new CouchbaseClient("couchbase://{$host}:{$port}", $username, $password); |
| 159 | 159 | |
| 160 | 160 | foreach ($buckets as $bucket) { |
| 161 | - $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ]; |
|
| 162 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ])); |
|
| 161 | + $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket']; |
|
| 162 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password'])); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | protected function getBucket() |
| 173 | 173 | { |
| 174 | - return $this->bucketInstances[ $this->bucketCurrent ]; |
|
| 174 | + return $this->bucketInstances[$this->bucketCurrent]; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket) |
| 183 | 183 | { |
| 184 | 184 | if (!array_key_exists($bucketName, $this->bucketInstances)) { |
| 185 | - $this->bucketInstances[ $bucketName ] = $CouchbaseBucket; |
|
| 185 | + $this->bucketInstances[$bucketName] = $CouchbaseBucket; |
|
| 186 | 186 | } else { |
| 187 | 187 | throw new phpFastCacheLogicException('A bucket instance with this name already exists.'); |
| 188 | 188 | } |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | $info = $this->getBucket()->manager()->info(); |
| 203 | 203 | |
| 204 | 204 | return (new DriverStatistic()) |
| 205 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 205 | + ->setSize($info['basicStats']['diskUsed']) |
|
| 206 | 206 | ->setRawData($info) |
| 207 | 207 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 208 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 208 | + ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, |
|
| 209 | 209 | 1) . "\n For more information see RawData."); |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | \ No newline at end of file |