@@ -137,10 +137,10 @@ |
||
| 137 | 137 | $info = xcache_info(XC_TYPE_VAR, 0); |
| 138 | 138 | |
| 139 | 139 | return (new DriverStatistic()) |
| 140 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
| 141 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 142 | - ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
|
| 143 | - ->setRawData($info); |
|
| 140 | + ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
| 141 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 142 | + ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
|
| 143 | + ->setRawData($info); |
|
| 144 | 144 | } else { |
| 145 | 145 | throw new \RuntimeException("PhpFastCache is not able to read Xcache configuration. Please put this to your php.ini:\n |
| 146 | 146 | [xcache.admin] |
@@ -137,7 +137,7 @@ |
||
| 137 | 137 | $info = xcache_info(XC_TYPE_VAR, 0); |
| 138 | 138 | |
| 139 | 139 | return (new DriverStatistic()) |
| 140 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
| 140 | + ->setSize(abs($info['size'] - $info['avail'])) |
|
| 141 | 141 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 142 | 142 | ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
| 143 | 143 | ->setRawData($info); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @param \Psr\Cache\CacheItemInterface $item |
| 63 | - * @return mixed |
|
| 63 | + * @return boolean |
|
| 64 | 64 | * @throws phpFastCacheDriverException |
| 65 | 65 | * @throws phpFastCacheInvalidArgumentException |
| 66 | 66 | */ |
@@ -187,6 +187,7 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | + * @param string $docId |
|
| 190 | 191 | * @return string|null |
| 191 | 192 | */ |
| 192 | 193 | protected function getLatestDocumentRevision($docId) |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | if ($item instanceof Item) { |
| 73 | 73 | try { |
| 74 | 74 | $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(), |
| 75 | - $this->getLatestDocumentRevision($item->getEncodedKey())); |
|
| 75 | + $this->getLatestDocumentRevision($item->getEncodedKey())); |
|
| 76 | 76 | } catch (CouchDBException $e) { |
| 77 | 77 | throw new phpFastCacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e); |
| 78 | 78 | } |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | $url .= $path; |
| 175 | 175 | |
| 176 | 176 | $this->instance = CouchDBClient::create([ |
| 177 | - 'dbname' => $this->getDatabaseName(), |
|
| 178 | - 'url' => $url, |
|
| 179 | - 'timeout' => $timeout, |
|
| 177 | + 'dbname' => $this->getDatabaseName(), |
|
| 178 | + 'url' => $url, |
|
| 179 | + 'timeout' => $timeout, |
|
| 180 | 180 | ]); |
| 181 | 181 | |
| 182 | 182 | $this->createDatabase(); |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId); |
| 194 | 194 | |
| 195 | 195 | $response = $this->instance->getHttpClient()->request( |
| 196 | - 'HEAD', |
|
| 197 | - $path, |
|
| 198 | - null, |
|
| 199 | - false |
|
| 196 | + 'HEAD', |
|
| 197 | + $path, |
|
| 198 | + null, |
|
| 199 | + false |
|
| 200 | 200 | ); |
| 201 | 201 | if (!empty($response->headers[ 'etag' ])) { |
| 202 | 202 | return trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B"); |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | $info = $this->instance->getDatabaseInfo(); |
| 251 | 251 | |
| 252 | 252 | return (new DriverStatistic()) |
| 253 | - ->setSize($info[ 'sizes' ][ 'active' ]) |
|
| 254 | - ->setRawData($info) |
|
| 255 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 256 | - ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
|
| 253 | + ->setSize($info[ 'sizes' ][ 'active' ]) |
|
| 254 | + ->setRawData($info) |
|
| 255 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 256 | + ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | \ No newline at end of file |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | throw new phpFastCacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if ($response->status === 404 || empty($response->body[ 'data' ])) { |
|
| 98 | + if ($response->status === 404 || empty($response->body['data'])) { |
|
| 99 | 99 | return null; |
| 100 | 100 | } else if ($response->status === 200) { |
| 101 | - return $this->decode($response->body[ 'data' ]); |
|
| 101 | + return $this->decode($response->body['data']); |
|
| 102 | 102 | } else { |
| 103 | 103 | throw new phpFastCacheDriverException('Got unexpected HTTP status: ' . $response->status); |
| 104 | 104 | } |
@@ -153,13 +153,13 @@ discard block |
||
| 153 | 153 | if ($this->instance instanceof CouchdbClient) { |
| 154 | 154 | throw new phpFastCacheLogicException('Already connected to Couchdb server'); |
| 155 | 155 | } else { |
| 156 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 157 | - $ssl = isset($this->config[ 'ssl' ]) ? $this->config[ 'ssl' ] : false; |
|
| 158 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 5984; |
|
| 159 | - $path = isset($this->config[ 'path' ]) ? $this->config[ 'path' ] : '/'; |
|
| 160 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
| 161 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 162 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 10; |
|
| 156 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 157 | + $ssl = isset($this->config['ssl']) ? $this->config['ssl'] : false; |
|
| 158 | + $port = isset($this->config['port']) ? $this->config['port'] : 5984; |
|
| 159 | + $path = isset($this->config['path']) ? $this->config['path'] : '/'; |
|
| 160 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
| 161 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 162 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 10; |
|
| 163 | 163 | |
| 164 | 164 | $url = ($ssl ? 'https://' : 'http://'); |
| 165 | 165 | if ($username) { |
@@ -198,8 +198,8 @@ discard block |
||
| 198 | 198 | null, |
| 199 | 199 | false |
| 200 | 200 | ); |
| 201 | - if (!empty($response->headers[ 'etag' ])) { |
|
| 202 | - return trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B"); |
|
| 201 | + if (!empty($response->headers['etag'])) { |
|
| 202 | + return trim($response->headers['etag'], " '\"\t\n\r\0\x0B"); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | return null; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | protected function getDatabaseName() |
| 212 | 212 | { |
| 213 | - return isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : 'phpfastcache'; |
|
| 213 | + return isset($this->config['database']) ? $this->config['database'] : 'phpfastcache'; |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $info = $this->instance->getDatabaseInfo(); |
| 251 | 251 | |
| 252 | 252 | return (new DriverStatistic()) |
| 253 | - ->setSize($info[ 'sizes' ][ 'active' ]) |
|
| 253 | + ->setSize($info['sizes']['active']) |
|
| 254 | 254 | ->setRawData($info) |
| 255 | 255 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 256 | 256 | ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
@@ -137,10 +137,10 @@ |
||
| 137 | 137 | $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
| 138 | 138 | |
| 139 | 139 | return (new DriverStatistic()) |
| 140 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 141 | - ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
|
| 140 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 141 | + ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
|
| 142 | 142 | $stats[ 'num_entries' ])) |
| 143 | - ->setRawData($stats) |
|
| 144 | - ->setSize($stats[ 'mem_size' ]); |
|
| 143 | + ->setRawData($stats) |
|
| 144 | + ->setSize($stats[ 'mem_size' ]); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | \ No newline at end of file |
@@ -133,14 +133,14 @@ |
||
| 133 | 133 | */ |
| 134 | 134 | public function getStats() |
| 135 | 135 | { |
| 136 | - $stats = (array)apcu_cache_info(); |
|
| 137 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
| 136 | + $stats = (array) apcu_cache_info(); |
|
| 137 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
| 138 | 138 | |
| 139 | 139 | return (new DriverStatistic()) |
| 140 | 140 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 141 | 141 | ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
| 142 | - $stats[ 'num_entries' ])) |
|
| 142 | + $stats['num_entries'])) |
|
| 143 | 143 | ->setRawData($stats) |
| 144 | - ->setSize($stats[ 'mem_size' ]); |
|
| 144 | + ->setSize($stats['mem_size']); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | \ No newline at end of file |
@@ -147,9 +147,9 @@ |
||
| 147 | 147 | { |
| 148 | 148 | $stat = new DriverStatistic(); |
| 149 | 149 | $stat->setInfo('[ZendDisk] A void info string') |
| 150 | - ->setSize(0) |
|
| 151 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 152 | - ->setRawData(false); |
|
| 150 | + ->setSize(0) |
|
| 151 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 152 | + ->setRawData(false); |
|
| 153 | 153 | |
| 154 | 154 | return $stat; |
| 155 | 155 | } |
@@ -147,9 +147,9 @@ |
||
| 147 | 147 | { |
| 148 | 148 | $stats = (array)zend_shm_cache_info(); |
| 149 | 149 | return (new DriverStatistic()) |
| 150 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 151 | - ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ])) |
|
| 152 | - ->setRawData($stats) |
|
| 153 | - ->setSize($stats[ 'memory_total' ]); |
|
| 150 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 151 | + ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ])) |
|
| 152 | + ->setRawData($stats) |
|
| 153 | + ->setSize($stats[ 'memory_total' ]); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | \ No newline at end of file |
@@ -145,11 +145,11 @@ |
||
| 145 | 145 | */ |
| 146 | 146 | public function getStats() |
| 147 | 147 | { |
| 148 | - $stats = (array)zend_shm_cache_info(); |
|
| 148 | + $stats = (array) zend_shm_cache_info(); |
|
| 149 | 149 | return (new DriverStatistic()) |
| 150 | 150 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 151 | - ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ])) |
|
| 151 | + ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total'])) |
|
| 152 | 152 | ->setRawData($stats) |
| 153 | - ->setSize($stats[ 'memory_total' ]); |
|
| 153 | + ->setSize($stats['memory_total']); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | \ No newline at end of file |
@@ -125,7 +125,7 @@ |
||
| 125 | 125 | $this->instance->close(); |
| 126 | 126 | $this->instance = null; |
| 127 | 127 | } |
| 128 | - $result = (bool)LeveldbClient::destroy($this->getLeveldbFile()); |
|
| 128 | + $result = (bool) LeveldbClient::destroy($this->getLeveldbFile()); |
|
| 129 | 129 | $this->driverConnect(); |
| 130 | 130 | |
| 131 | 131 | return $result; |
@@ -140,9 +140,9 @@ |
||
| 140 | 140 | { |
| 141 | 141 | $stat = new DriverStatistic(); |
| 142 | 142 | $stat->setInfo('[Memstatic] A memory static driver') |
| 143 | - ->setSize(mb_strlen(serialize($this->staticStack))) |
|
| 144 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 145 | - ->setRawData($this->staticStack); |
|
| 143 | + ->setSize(mb_strlen(serialize($this->staticStack))) |
|
| 144 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 145 | + ->setRawData($this->staticStack); |
|
| 146 | 146 | |
| 147 | 147 | return $stat; |
| 148 | 148 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * Check for Cross-Driver type confusion |
| 69 | 69 | */ |
| 70 | 70 | if ($item instanceof Item) { |
| 71 | - return $this->staticStack[ md5($item->getKey()) ] = $this->driverPreWrap($item); |
|
| 71 | + return $this->staticStack[md5($item->getKey())] = $this->driverPreWrap($item); |
|
| 72 | 72 | } else { |
| 73 | 73 | throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected'); |
| 74 | 74 | } |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | protected function driverRead(CacheItemInterface $item) |
| 82 | 82 | { |
| 83 | 83 | $key = md5($item->getKey()); |
| 84 | - if (isset($this->staticStack[ $key ])) { |
|
| 85 | - return $this->staticStack[ $key ]; |
|
| 84 | + if (isset($this->staticStack[$key])) { |
|
| 85 | + return $this->staticStack[$key]; |
|
| 86 | 86 | } |
| 87 | 87 | return null; |
| 88 | 88 | } |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | if ($item instanceof Item) { |
| 101 | 101 | $key = md5($item->getKey()); |
| 102 | - if (isset($this->staticStack[ $key ])) { |
|
| 103 | - unset($this->staticStack[ $key ]); |
|
| 102 | + if (isset($this->staticStack[$key])) { |
|
| 103 | + unset($this->staticStack[$key]); |
|
| 104 | 104 | return true; |
| 105 | 105 | } |
| 106 | 106 | return false; |
@@ -163,10 +163,10 @@ |
||
| 163 | 163 | $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
| 164 | 164 | |
| 165 | 165 | return (new DriverStatistic()) |
| 166 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 167 | - ->setRawData($info) |
|
| 168 | - ->setSize($info[ 'used_memory' ]) |
|
| 169 | - ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
| 166 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 167 | + ->setRawData($info) |
|
| 168 | + ->setSize($info[ 'used_memory' ]) |
|
| 169 | + ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
| 170 | 170 | $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | \ No newline at end of file |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * @param \Psr\Cache\CacheItemInterface $item |
| 103 | - * @return bool |
|
| 103 | + * @return integer |
|
| 104 | 104 | * @throws phpFastCacheInvalidArgumentException |
| 105 | 105 | */ |
| 106 | 106 | protected function driverDelete(CacheItemInterface $item) |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | * @see https://redis.io/commands/setex |
| 75 | 75 | * @see https://redis.io/commands/expire |
| 76 | 76 | */ |
| 77 | - if($ttl <= 0){ |
|
| 77 | + if ($ttl <= 0) { |
|
| 78 | 78 | return $this->instance->expire($item->getKey(), 0); |
| 79 | - }else{ |
|
| 79 | + } else { |
|
| 80 | 80 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item))); |
| 81 | 81 | } |
| 82 | 82 | } else { |
@@ -134,31 +134,31 @@ discard block |
||
| 134 | 134 | } else { |
| 135 | 135 | $this->instance = $this->instance ?: new RedisClient(); |
| 136 | 136 | |
| 137 | - $host = isset($this->config[ 'host' ]) ? (string) $this->config[ 'host' ] : '127.0.0.1'; |
|
| 138 | - $path = isset($this->config[ 'path' ]) ? (string) $this->config[ 'path' ] : false; |
|
| 139 | - $port = isset($this->config[ 'port' ]) ? (int) $this->config[ 'port' ] : 6379; |
|
| 140 | - $password = isset($this->config[ 'password' ]) ? (string) $this->config[ 'password' ] : ''; |
|
| 141 | - $database = isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : false; |
|
| 142 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : ''; |
|
| 137 | + $host = isset($this->config['host']) ? (string) $this->config['host'] : '127.0.0.1'; |
|
| 138 | + $path = isset($this->config['path']) ? (string) $this->config['path'] : false; |
|
| 139 | + $port = isset($this->config['port']) ? (int) $this->config['port'] : 6379; |
|
| 140 | + $password = isset($this->config['password']) ? (string) $this->config['password'] : ''; |
|
| 141 | + $database = isset($this->config['database']) ? $this->config['database'] : false; |
|
| 142 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : ''; |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * If path is provided we consider it as an UNIX Socket |
| 146 | 146 | */ |
| 147 | - if($path){ |
|
| 147 | + if ($path) { |
|
| 148 | 148 | $isConnected = $this->instance->connect($path); |
| 149 | - }else{ |
|
| 150 | - $isConnected = $this->instance->connect($host, (int)$port, (int)$timeout); |
|
| 149 | + } else { |
|
| 150 | + $isConnected = $this->instance->connect($host, (int) $port, (int) $timeout); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (!$isConnected && $path) { |
| 154 | 154 | return false; |
| 155 | - } else if(!$path) { |
|
| 155 | + } else if (!$path) { |
|
| 156 | 156 | if ($password && !$this->instance->auth($password)) { |
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | if ($database !== false) { |
| 161 | - $this->instance->select((int)$database); |
|
| 161 | + $this->instance->select((int) $database); |
|
| 162 | 162 | } |
| 163 | 163 | return true; |
| 164 | 164 | } |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | { |
| 178 | 178 | // used_memory |
| 179 | 179 | $info = $this->instance->info(); |
| 180 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
|
| 180 | + $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']); |
|
| 181 | 181 | |
| 182 | 182 | return (new DriverStatistic()) |
| 183 | 183 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 184 | 184 | ->setRawData($info) |
| 185 | - ->setSize($info[ 'used_memory' ]) |
|
| 185 | + ->setSize($info['used_memory']) |
|
| 186 | 186 | ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
| 187 | - $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
| 187 | + $info['redis_version'], $date->format(DATE_RFC2822))); |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | \ No newline at end of file |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | if($ttl <= 0){ |
| 78 | 78 | return $this->instance->expire($item->getKey(), 0); |
| 79 | - }else{ |
|
| 79 | + } else{ |
|
| 80 | 80 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item))); |
| 81 | 81 | } |
| 82 | 82 | } else { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | if($path){ |
| 148 | 148 | $isConnected = $this->instance->connect($path); |
| 149 | - }else{ |
|
| 149 | + } else{ |
|
| 150 | 150 | $isConnected = $this->instance->connect($host, (int)$port, (int)$timeout); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -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; |