@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | } else { |
| 123 | 123 | $this->instance = $this->instance ?: new RedisClient(); |
| 124 | 124 | |
| 125 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 126 | - $port = isset($this->config[ 'port' ]) ? (int) $this->config[ 'port' ] : '6379'; |
|
| 127 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 128 | - $database = isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : ''; |
|
| 129 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : ''; |
|
| 125 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 126 | + $port = isset($this->config['port']) ? (int) $this->config['port'] : '6379'; |
|
| 127 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 128 | + $database = isset($this->config['database']) ? $this->config['database'] : ''; |
|
| 129 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : ''; |
|
| 130 | 130 | |
| 131 | 131 | if (!$this->instance->connect($host, (int) $port, (int) $timeout)) { |
| 132 | 132 | return false; |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | { |
| 157 | 157 | // used_memory |
| 158 | 158 | $info = $this->instance->info(); |
| 159 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
|
| 159 | + $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']); |
|
| 160 | 160 | |
| 161 | 161 | return (new driverStatistic()) |
| 162 | 162 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 163 | 163 | ->setRawData($info) |
| 164 | - ->setSize($info[ 'used_memory' ]) |
|
| 165 | - ->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.", $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
| 164 | + ->setSize($info['used_memory']) |
|
| 165 | + ->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.", $info['redis_version'], $date->format(DATE_RFC2822))); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | \ No newline at end of file |
@@ -133,12 +133,12 @@ |
||
| 133 | 133 | public function getStats() |
| 134 | 134 | { |
| 135 | 135 | $stats = (array) apc_cache_info('user'); |
| 136 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
| 136 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
| 137 | 137 | |
| 138 | 138 | return (new driverStatistic()) |
| 139 | 139 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 140 | - ->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), $stats[ 'num_entries' ])) |
|
| 140 | + ->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), $stats['num_entries'])) |
|
| 141 | 141 | ->setRawData($stats) |
| 142 | - ->setSize($stats[ 'mem_size' ]); |
|
| 142 | + ->setSize($stats['mem_size']); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | \ No newline at end of file |
@@ -129,11 +129,11 @@ |
||
| 129 | 129 | { |
| 130 | 130 | $memInfo = wincache_ucache_meminfo(); |
| 131 | 131 | $info = wincache_ucache_info(); |
| 132 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]); |
|
| 132 | + $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']); |
|
| 133 | 133 | |
| 134 | 134 | return (new driverStatistic()) |
| 135 | 135 | ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
| 136 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
| 136 | + ->setSize($memInfo['memory_free'] - $memInfo['memory_total']) |
|
| 137 | 137 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 138 | 138 | ->setRawData($memInfo); |
| 139 | 139 | } |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | $info = xcache_info(XC_TYPE_VAR, 0); |
| 137 | 137 | |
| 138 | 138 | return (new driverStatistic()) |
| 139 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
| 139 | + ->setSize(abs($info['size'] - $info['avail'])) |
|
| 140 | 140 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 141 | 141 | ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
| 142 | 142 | ->setRawData($info); |
@@ -133,13 +133,13 @@ |
||
| 133 | 133 | public function getStats() |
| 134 | 134 | { |
| 135 | 135 | $stats = (array) apc_cache_info('user'); |
| 136 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
| 136 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
| 137 | 137 | |
| 138 | 138 | return (new driverStatistic()) |
| 139 | 139 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 140 | 140 | ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
| 141 | - $stats[ 'num_entries' ])) |
|
| 141 | + $stats['num_entries'])) |
|
| 142 | 142 | ->setRawData($stats) |
| 143 | - ->setSize($stats[ 'mem_size' ]); |
|
| 143 | + ->setSize($stats['mem_size']); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | \ No newline at end of file |
@@ -138,17 +138,17 @@ discard block |
||
| 138 | 138 | protected function driverConnect() |
| 139 | 139 | { |
| 140 | 140 | try { |
| 141 | - $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [ |
|
| 141 | + $server = isset($this->config['ssdb']) ? $this->config['ssdb'] : [ |
|
| 142 | 142 | 'host' => "127.0.0.1", |
| 143 | 143 | 'port' => 8888, |
| 144 | 144 | 'password' => '', |
| 145 | 145 | 'timeout' => 2000, |
| 146 | 146 | ]; |
| 147 | 147 | |
| 148 | - $host = $server[ 'host' ]; |
|
| 149 | - $port = isset($server[ 'port' ]) ? (int) $server[ 'port' ] : 8888; |
|
| 150 | - $password = isset($server[ 'password' ]) ? $server[ 'password' ] : ''; |
|
| 151 | - $timeout = !empty($server[ 'timeout' ]) ? (int) $server[ 'timeout' ] : 2000; |
|
| 148 | + $host = $server['host']; |
|
| 149 | + $port = isset($server['port']) ? (int) $server['port'] : 8888; |
|
| 150 | + $password = isset($server['password']) ? $server['password'] : ''; |
|
| 151 | + $timeout = !empty($server['timeout']) ? (int) $server['timeout'] : 2000; |
|
| 152 | 152 | $this->instance = new SimpleSSDB($host, $port, $timeout); |
| 153 | 153 | if (!empty($password)) { |
| 154 | 154 | $this->instance->auth($password); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * Data returned by Ssdb are very poorly formatted |
| 183 | 183 | * using hardcoded offset of pair key-value :-( |
| 184 | 184 | */ |
| 185 | - $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ])) |
|
| 185 | + $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6])) |
|
| 186 | 186 | ->setRawData($info) |
| 187 | 187 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 188 | 188 | ->setSize($this->instance->dbsize()); |
@@ -74,9 +74,9 @@ |
||
| 74 | 74 | */ |
| 75 | 75 | public function __call($name, $args) |
| 76 | 76 | { |
| 77 | - if(method_exists($this->instance, $name)){ |
|
| 77 | + if (method_exists($this->instance, $name)) { |
|
| 78 | 78 | return call_user_func_array([$this->instance, $name], $args); |
| 79 | - }else{ |
|
| 79 | + } else { |
|
| 80 | 80 | throw new \BadMethodCallException(sprintf('Method %s does not exists', $name)); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -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 | } |
@@ -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 | /** |