@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function getAll($enabled=true) { |
|
| 130 | + public function getAll($enabled = true) { |
|
| 131 | 131 | |
| 132 | 132 | return $enabled ? $this->getEnabled() : $this->stack; |
| 133 | 133 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | $return = array(); |
| 196 | 196 | |
| 197 | - foreach ($this->stack as $id => $cache) { |
|
| 197 | + foreach ( $this->stack as $id => $cache ) { |
|
| 198 | 198 | $this->checkCacheFlap($id, $cache); |
| 199 | 199 | if ( $cache->isEnabled() ) $return[$id] = $cache; |
| 200 | 200 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | /** |
| 42 | 42 | * {@inheritdoc} |
| 43 | 43 | */ |
| 44 | - public function setNamespace($namespace=null) { |
|
| 44 | + public function setNamespace($namespace = null) { |
|
| 45 | 45 | |
| 46 | 46 | if ( empty($namespace) ) { |
| 47 | 47 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * |
| 35 | 35 | * @throws \Comodojo\Exception\CacheException |
| 36 | 36 | */ |
| 37 | - public function __construct( $server, $port=11211, $weight=0, $persistent_id=null, LoggerInterface $logger=null ) { |
|
| 37 | + public function __construct($server, $port = 11211, $weight = 0, $persistent_id = null, LoggerInterface $logger = null) { |
|
| 38 | 38 | |
| 39 | 39 | parent::__construct($server, $port, $weight, $persistent_id, $logger); |
| 40 | 40 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | * |
| 34 | 34 | * @throws \Comodojo\Exception\CacheException |
| 35 | 35 | */ |
| 36 | - public function __construct( $server, $port=6379, $timeout=0, LoggerInterface $logger=null ) { |
|
| 36 | + public function __construct($server, $port = 6379, $timeout = 0, LoggerInterface $logger = null) { |
|
| 37 | 37 | |
| 38 | 38 | parent::__construct($server, $port, $timeout, $logger); |
| 39 | 39 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @throws \Comodojo\Exception\CacheException |
| 42 | 42 | */ |
| 43 | - public function __construct( $server, $port=11211, $weight=0, $persistent_id=null, LoggerInterface $logger=null ) { |
|
| 43 | + public function __construct($server, $port = 11211, $weight = 0, $persistent_id = null, LoggerInterface $logger = null) { |
|
| 44 | 44 | |
| 45 | 45 | if ( empty($server) ) throw new CacheException("Invalid or unspecified memcached server"); |
| 46 | 46 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * {@inheritdoc} |
| 69 | 69 | */ |
| 70 | - public function set($name, $data, $ttl=null) { |
|
| 70 | + public function set($name, $data, $ttl = null) { |
|
| 71 | 71 | |
| 72 | 72 | if ( empty($name) ) throw new CacheException("Name of object cannot be empty"); |
| 73 | 73 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | /** |
| 173 | 173 | * {@inheritdoc} |
| 174 | 174 | */ |
| 175 | - public function delete($name=null) { |
|
| 175 | + public function delete($name = null) { |
|
| 176 | 176 | |
| 177 | 177 | if ( !$this->isEnabled() ) return false; |
| 178 | 178 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $objects = 0; |
| 254 | 254 | |
| 255 | - foreach ($stats as $key => $value) { |
|
| 255 | + foreach ( $stats as $key => $value ) { |
|
| 256 | 256 | |
| 257 | 257 | $objects = max($objects, $value['curr_items']); |
| 258 | 258 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @throws \Comodojo\Exception\CacheException |
| 34 | 34 | */ |
| 35 | - public function __construct(LoggerInterface $logger=null ) { |
|
| 35 | + public function __construct(LoggerInterface $logger = null) { |
|
| 36 | 36 | |
| 37 | 37 | parent::__construct($logger); |
| 38 | 38 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * {@inheritdoc} |
| 53 | 53 | */ |
| 54 | - public function set($name, $data, $ttl=null) { |
|
| 54 | + public function set($name, $data, $ttl = null) { |
|
| 55 | 55 | |
| 56 | 56 | if ( empty($name) ) throw new CacheException("Name of object cannot be empty"); |
| 57 | 57 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | /** |
| 122 | 122 | * {@inheritdoc} |
| 123 | 123 | */ |
| 124 | - public function delete($name=null) { |
|
| 124 | + public function delete($name = null) { |
|
| 125 | 125 | |
| 126 | 126 | if ( !$this->isEnabled() ) return false; |
| 127 | 127 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | private static function getXCacheStatus() { |
| 186 | 186 | |
| 187 | - return ( extension_loaded('xcache') && function_exists("xcache_get") ); |
|
| 187 | + return (extension_loaded('xcache') && function_exists("xcache_get")); |
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @throws \Comodojo\Exception\CacheException |
| 42 | 42 | */ |
| 43 | - public function __construct( $server, $port=6379, $timeout=0, LoggerInterface $logger=null ) { |
|
| 43 | + public function __construct($server, $port = 6379, $timeout = 0, LoggerInterface $logger = null) { |
|
| 44 | 44 | |
| 45 | 45 | if ( empty($server) ) throw new CacheException("Invalid or unspecified memcached server"); |
| 46 | 46 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | if ( $this->instance->connect($server, $port, $weight) === false ) { |
| 77 | 77 | |
| 78 | - $this->logger->error("Error communicating with Redis server, disabling PhpRedisProvider administratively", array( $this->instance->getLastError() ) ); |
|
| 78 | + $this->logger->error("Error communicating with Redis server, disabling PhpRedisProvider administratively", array($this->instance->getLastError())); |
|
| 79 | 79 | |
| 80 | 80 | $this->disable(); |
| 81 | 81 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * {@inheritdoc} |
| 88 | 88 | */ |
| 89 | - public function set($name, $data, $ttl=null) { |
|
| 89 | + public function set($name, $data, $ttl = null) { |
|
| 90 | 90 | |
| 91 | 91 | if ( empty($name) ) throw new CacheException("Name of object cannot be empty"); |
| 92 | 92 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | if ( $namespace === false ) { |
| 108 | 108 | |
| 109 | - $this->logger->error("Error writing cache (PhpRedis), exiting gracefully", array( $this->instance->getLastError())); |
|
| 109 | + $this->logger->error("Error writing cache (PhpRedis), exiting gracefully", array($this->instance->getLastError())); |
|
| 110 | 110 | |
| 111 | 111 | $this->setErrorState("Error writing cache (PhpRedis)"); |
| 112 | 112 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | if ( $return === false ) { |
| 126 | 126 | |
| 127 | - $this->logger->error("Error writing cache (PhpRedis), exiting gracefully", array( $this->instance->getLastError())); |
|
| 127 | + $this->logger->error("Error writing cache (PhpRedis), exiting gracefully", array($this->instance->getLastError())); |
|
| 128 | 128 | |
| 129 | 129 | $this->setErrorState("Error writing cache (PhpRedis)"); |
| 130 | 130 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - } catch (RedisException $re ) { |
|
| 135 | + } catch (RedisException $re) { |
|
| 136 | 136 | |
| 137 | 137 | $this->logger->error("Server unreachable (PhpRedis), exiting gracefully", array( |
| 138 | 138 | "RESULTCODE" => $re->getCode(), |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - } catch (RedisException $re ) { |
|
| 191 | + } catch (RedisException $re) { |
|
| 192 | 192 | |
| 193 | 193 | $this->logger->error("Server unreachable (PhpRedis), exiting gracefully", array( |
| 194 | 194 | "RESULTCODE" => $re->getCode(), |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | /** |
| 213 | 213 | * {@inheritdoc} |
| 214 | 214 | */ |
| 215 | - public function delete($name=null) { |
|
| 215 | + public function delete($name = null) { |
|
| 216 | 216 | |
| 217 | 217 | if ( !$this->isEnabled() ) return false; |
| 218 | 218 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - } catch (RedisException $re ) { |
|
| 237 | + } catch (RedisException $re) { |
|
| 238 | 238 | |
| 239 | 239 | $this->logger->error("Server unreachable (PhpRedis), exiting gracefully", array( |
| 240 | 240 | "RESULTCODE" => $re->getCode(), |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | $this->instance->flushDB(); |
| 270 | 270 | |
| 271 | - } catch (RedisException $re ) { |
|
| 271 | + } catch (RedisException $re) { |
|
| 272 | 272 | |
| 273 | 273 | $this->logger->error("Server unreachable (PhpRedis), exiting gracefully", array( |
| 274 | 274 | "RESULTCODE" => $re->getCode(), |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | |
| 312 | 312 | $options = $this->instance->info(); |
| 313 | 313 | |
| 314 | - } catch (RedisException $re ) { |
|
| 314 | + } catch (RedisException $re) { |
|
| 315 | 315 | |
| 316 | 316 | $this->logger->error("Server unreachable (PhpRedis), exiting gracefully", array( |
| 317 | 317 | "RESULTCODE" => $re->getCode(), |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | $return = $this->instance->set($this->getNamespace(), $uId); |
| 348 | 348 | |
| 349 | - } catch (RedisException $re ) { |
|
| 349 | + } catch (RedisException $re) { |
|
| 350 | 350 | |
| 351 | 351 | throw $re; |
| 352 | 352 | |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | $return = $this->instance->get($this->getNamespace()); |
| 369 | 369 | |
| 370 | - } catch (RedisException $re ) { |
|
| 370 | + } catch (RedisException $re) { |
|
| 371 | 371 | |
| 372 | 372 | throw $re; |
| 373 | 373 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | // In cli, apcu SHOULD NOT use the request time for cache retrieve/invalidation. |
| 48 | 48 | // This is because in cli the request time is allways the same. |
| 49 | 49 | if ( php_sapi_name() === 'cli' ) { |
| 50 | - ini_set('apc.use_request_time',0); |
|
| 50 | + ini_set('apc.use_request_time', 0); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | if ( $apcu ) self::$is_apcu = true; |
| 294 | 294 | |
| 295 | - return ( ( $apc || $apcu ) && ini_get('apc.enabled') ); |
|
| 295 | + return (($apc || $apcu) && ini_get('apc.enabled')); |
|
| 296 | 296 | |
| 297 | 297 | } |
| 298 | 298 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function setAutoSetTime($mode=true) { |
|
| 91 | + public function setAutoSetTime($mode = true) { |
|
| 92 | 92 | |
| 93 | 93 | $this->auto_set_time = filter_var($mode, FILTER_VALIDATE_BOOLEAN, array( |
| 94 | 94 | 'options' => array( |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - public function getProviders($enabled=false) { |
|
| 162 | + public function getProviders($enabled = false) { |
|
| 163 | 163 | |
| 164 | 164 | return $enabled ? $this->stack->getAll() : $this->stack->getAll(false); |
| 165 | 165 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | $set = array(); |
| 225 | 225 | |
| 226 | - foreach ($this->stack->getAll() as $id => $provider) { |
|
| 226 | + foreach ( $this->stack->getAll() as $id => $provider ) { |
|
| 227 | 227 | |
| 228 | 228 | $set[] = $provider->set($name, $data, $ttl); |
| 229 | 229 | |
@@ -259,13 +259,13 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - public function delete($name=null) { |
|
| 262 | + public function delete($name = null) { |
|
| 263 | 263 | |
| 264 | 264 | if ( !$this->isEnabled() ) return false; |
| 265 | 265 | |
| 266 | 266 | $delete = array(); |
| 267 | 267 | |
| 268 | - foreach ($this->stack->getAll() as $id => $provider) { |
|
| 268 | + foreach ( $this->stack->getAll() as $id => $provider ) { |
|
| 269 | 269 | |
| 270 | 270 | $delete[] = $provider->delete($name); |
| 271 | 271 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | $flush = array(); |
| 285 | 285 | |
| 286 | - foreach ($this->stack->getAll() as $id => $provider) { |
|
| 286 | + foreach ( $this->stack->getAll() as $id => $provider ) { |
|
| 287 | 287 | |
| 288 | 288 | $flush[] = $provider->flush(); |
| 289 | 289 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | if ( !$this->isEnabled() ) { |
| 303 | 303 | |
| 304 | - foreach ($this->stack->getAll(false) as $id => $provider) { |
|
| 304 | + foreach ( $this->stack->getAll(false) as $id => $provider ) { |
|
| 305 | 305 | $return[] = array( |
| 306 | 306 | "provider" => get_class($provider), |
| 307 | 307 | "enabled" => false, |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | } else { |
| 314 | 314 | |
| 315 | - foreach ($this->stack->getAll(false) as $id => $provider) { |
|
| 315 | + foreach ( $this->stack->getAll(false) as $id => $provider ) { |
|
| 316 | 316 | $return[] = $provider->status(); |
| 317 | 317 | } |
| 318 | 318 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | private function getFromSingleProvider($selector, $name) { |
| 336 | 336 | |
| 337 | - switch ($this->selector) { |
|
| 337 | + switch ( $this->selector ) { |
|
| 338 | 338 | |
| 339 | 339 | case 1: |
| 340 | 340 | $this->provider = $this->stack->getFirst(); |
@@ -365,14 +365,14 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | $providers = $this->stack->getAll(); |
| 367 | 367 | |
| 368 | - foreach ($providers as $id => $provider) { |
|
| 368 | + foreach ( $providers as $id => $provider ) { |
|
| 369 | 369 | $data[] = $this->provider->get($name); |
| 370 | 370 | if ( $this->provider->getErrorState() ) $this->stack->disable($this->provider->getCacheId()); |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | $values = array_unique(array_map('serialize', $data)); |
| 374 | 374 | |
| 375 | - if (count($values) == 1) { |
|
| 375 | + if ( count($values) == 1 ) { |
|
| 376 | 376 | return $data[0]; |
| 377 | 377 | } |
| 378 | 378 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | $providers = $this->stack->getAll(); |
| 388 | 388 | |
| 389 | - foreach ($providers as $id => $provider) { |
|
| 389 | + foreach ( $providers as $id => $provider ) { |
|
| 390 | 390 | $data = $provider->get($name); |
| 391 | 391 | if ( $provider->getErrorState() ) { |
| 392 | 392 | $this->stack->disable($provider->getCacheId()); |