@@ -66,9 +66,7 @@ |
||
| 66 | 66 | |
| 67 | 67 | parent::__construct($logger); |
| 68 | 68 | |
| 69 | - } |
|
| 70 | - |
|
| 71 | - catch (CacheException $ce) { |
|
| 69 | + } catch (CacheException $ce) { |
|
| 72 | 70 | |
| 73 | 71 | throw $ce; |
| 74 | 72 | |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | |
| 516 | 516 | $size = sizeof($caches); |
| 517 | 517 | |
| 518 | - for ( $i = 0; $i < $size; $i++ ) { |
|
| 518 | + for ( $i = 0; $i < $size; $i++ ) { |
|
| 519 | 519 | |
| 520 | 520 | $cache_id = array_rand($caches); |
| 521 | 521 | |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | |
| 562 | 562 | $size = sizeof($weights); |
| 563 | 563 | |
| 564 | - for ( $i = 0; $i < $size; $i++ ) { |
|
| 564 | + for ( $i = 0; $i < $size; $i++ ) { |
|
| 565 | 565 | |
| 566 | 566 | $cache_ids = array_keys($weights, max($weights)); |
| 567 | 567 | |
@@ -91,9 +91,7 @@ |
||
| 91 | 91 | |
| 92 | 92 | parent::__construct($logger); |
| 93 | 93 | |
| 94 | - } |
|
| 95 | - |
|
| 96 | - catch (CacheException $ce) { |
|
| 94 | + } catch (CacheException $ce) { |
|
| 97 | 95 | |
| 98 | 96 | throw $ce; |
| 99 | 97 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @throws \Comodojo\Exception\CacheException |
| 45 | 45 | */ |
| 46 | - public function __construct( $server, $port=6379, $timeout=0, \Monolog\Logger $logger=null ) { |
|
| 46 | + public function __construct($server, $port = 6379, $timeout = 0, \Monolog\Logger $logger = null) { |
|
| 47 | 47 | |
| 48 | 48 | if ( empty($server) ) throw new CacheException("Invalid or unspecified memcached server"); |
| 49 | 49 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | if ( $this->instance->connect($server, $port, $weight) === false ) { |
| 78 | 78 | |
| 79 | - $this->raiseError( "Error communicating with server", array( $this->instance->getLastError() ) ); |
|
| 79 | + $this->raiseError("Error communicating with server", array($this->instance->getLastError())); |
|
| 80 | 80 | |
| 81 | 81 | $this->disable(); |
| 82 | 82 | |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | try { |
| 86 | 86 | |
| 87 | - parent::__construct( $logger ); |
|
| 87 | + parent::__construct($logger); |
|
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - catch ( CacheException $ce ) { |
|
| 91 | + catch (CacheException $ce) { |
|
| 92 | 92 | |
| 93 | 93 | throw $ce; |
| 94 | 94 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @return bool |
| 112 | 112 | * @throws \Comodojo\Exception\CacheException |
| 113 | 113 | */ |
| 114 | - public function set($name, $data, $ttl=null) { |
|
| 114 | + public function set($name, $data, $ttl = null) { |
|
| 115 | 115 | |
| 116 | 116 | if ( empty($name) ) throw new CacheException("Name of object cannot be empty"); |
| 117 | 117 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | if ( $namespace === false ) { |
| 133 | 133 | |
| 134 | - $this->raiseError( "Error writing cache (PhpRedis), exiting gracefully", array( $this->instance->getLastError() ) ); |
|
| 134 | + $this->raiseError("Error writing cache (PhpRedis), exiting gracefully", array($this->instance->getLastError())); |
|
| 135 | 135 | |
| 136 | 136 | $this->setErrorState(); |
| 137 | 137 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | if ( $return === false ) { |
| 151 | 151 | |
| 152 | - $this->raiseError( "Error writing cache (PhpRedis), exiting gracefully", array( $this->instance->getLastError() ) ); |
|
| 152 | + $this->raiseError("Error writing cache (PhpRedis), exiting gracefully", array($this->instance->getLastError())); |
|
| 153 | 153 | |
| 154 | 154 | $this->setErrorState(); |
| 155 | 155 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | throw $ce; |
| 163 | 163 | |
| 164 | - } catch (RedisException $re ) { |
|
| 164 | + } catch (RedisException $re) { |
|
| 165 | 165 | |
| 166 | 166 | $this->raiseError("Server unreachable (PhpRedis), exiting gracefully", array( |
| 167 | 167 | "RESULTCODE" => $re->getCode(), |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | if ( $return === false ) { |
| 216 | 216 | |
| 217 | - $this->raiseError( "Error reading cache (PhpRedis), exiting gracefully", array( $this->instance->getLastError() ) ); |
|
| 217 | + $this->raiseError("Error reading cache (PhpRedis), exiting gracefully", array($this->instance->getLastError())); |
|
| 218 | 218 | |
| 219 | 219 | $this->setErrorState(); |
| 220 | 220 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | throw $ce; |
| 228 | 228 | |
| 229 | - } catch (RedisException $re ) { |
|
| 229 | + } catch (RedisException $re) { |
|
| 230 | 230 | |
| 231 | 231 | $this->raiseError("Server unreachable (PhpRedis), exiting gracefully", array( |
| 232 | 232 | "RESULTCODE" => $re->getCode(), |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @return bool |
| 255 | 255 | * @throws \Comodojo\Exception\CacheException |
| 256 | 256 | */ |
| 257 | - public function delete($name=null) { |
|
| 257 | + public function delete($name = null) { |
|
| 258 | 258 | |
| 259 | 259 | if ( !$this->isEnabled() ) return false; |
| 260 | 260 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | throw $ce; |
| 282 | 282 | |
| 283 | - } catch (RedisException $re ) { |
|
| 283 | + } catch (RedisException $re) { |
|
| 284 | 284 | |
| 285 | 285 | $this->raiseError("Server unreachable (PhpRedis), exiting gracefully", array( |
| 286 | 286 | "RESULTCODE" => $re->getCode(), |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | $this->instance->flushDB(); |
| 317 | 317 | |
| 318 | - } catch (RedisException $re ) { |
|
| 318 | + } catch (RedisException $re) { |
|
| 319 | 319 | |
| 320 | 320 | $this->raiseError("Server unreachable (PhpRedis), exiting gracefully", array( |
| 321 | 321 | "RESULTCODE" => $re->getCode(), |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | $options = $this->instance->info(); |
| 362 | 362 | |
| 363 | - } catch (RedisException $re ) { |
|
| 363 | + } catch (RedisException $re) { |
|
| 364 | 364 | |
| 365 | 365 | $this->raiseError("Server unreachable (PhpRedis), exiting gracefully", array( |
| 366 | 366 | "RESULTCODE" => $re->getCode(), |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | $return = $this->instance->set($this->getNamespace(), $uId); |
| 408 | 408 | |
| 409 | - } catch (RedisException $re ) { |
|
| 409 | + } catch (RedisException $re) { |
|
| 410 | 410 | |
| 411 | 411 | throw $re; |
| 412 | 412 | |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | $return = $this->instance->get($this->getNamespace()); |
| 429 | 429 | |
| 430 | - } catch (RedisException $re ) { |
|
| 430 | + } catch (RedisException $re) { |
|
| 431 | 431 | |
| 432 | 432 | throw $re; |
| 433 | 433 | |
@@ -86,9 +86,7 @@ |
||
| 86 | 86 | |
| 87 | 87 | parent::__construct( $logger ); |
| 88 | 88 | |
| 89 | - } |
|
| 90 | - |
|
| 91 | - catch ( CacheException $ce ) { |
|
| 89 | + } catch ( CacheException $ce ) { |
|
| 92 | 90 | |
| 93 | 91 | throw $ce; |
| 94 | 92 | |
@@ -35,9 +35,7 @@ |
||
| 35 | 35 | |
| 36 | 36 | parent::__construct($logger); |
| 37 | 37 | |
| 38 | - } |
|
| 39 | - |
|
| 40 | - catch (CacheException $ce) { |
|
| 38 | + } catch (CacheException $ce) { |
|
| 41 | 39 | |
| 42 | 40 | throw $ce; |
| 43 | 41 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @throws \Comodojo\Exception\CacheException |
| 33 | 33 | */ |
| 34 | - public function __construct( \Monolog\Logger $logger=null ) { |
|
| 34 | + public function __construct(\Monolog\Logger $logger = null) { |
|
| 35 | 35 | |
| 36 | 36 | if ( self::getXCacheStatus() === false ) { |
| 37 | 37 | |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | try { |
| 45 | 45 | |
| 46 | - parent::__construct( $logger ); |
|
| 46 | + parent::__construct($logger); |
|
| 47 | 47 | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - catch ( CacheException $ce ) { |
|
| 50 | + catch (CacheException $ce) { |
|
| 51 | 51 | |
| 52 | 52 | throw $ce; |
| 53 | 53 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return bool |
| 71 | 71 | * @throws \Comodojo\Exception\CacheException |
| 72 | 72 | */ |
| 73 | - public function set($name, $data, $ttl=null) { |
|
| 73 | + public function set($name, $data, $ttl = null) { |
|
| 74 | 74 | |
| 75 | 75 | if ( empty($name) ) throw new CacheException("Name of object cannot be empty"); |
| 76 | 76 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @return bool |
| 158 | 158 | * @throws \Comodojo\Exception\CacheException |
| 159 | 159 | */ |
| 160 | - public function delete($name=null) { |
|
| 160 | + public function delete($name = null) { |
|
| 161 | 161 | |
| 162 | 162 | if ( !$this->isEnabled() ) return false; |
| 163 | 163 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | private static function getXCacheStatus() { |
| 229 | 229 | |
| 230 | - return ( extension_loaded('xcache') && function_exists("xcache_get") ); |
|
| 230 | + return (extension_loaded('xcache') && function_exists("xcache_get")); |
|
| 231 | 231 | |
| 232 | 232 | } |
| 233 | 233 | |
@@ -45,9 +45,7 @@ |
||
| 45 | 45 | |
| 46 | 46 | parent::__construct( $logger ); |
| 47 | 47 | |
| 48 | - } |
|
| 49 | - |
|
| 50 | - catch ( CacheException $ce ) { |
|
| 48 | + } catch ( CacheException $ce ) { |
|
| 51 | 49 | |
| 52 | 50 | throw $ce; |
| 53 | 51 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @throws \Comodojo\Exception\CacheException |
| 45 | 45 | */ |
| 46 | - public function __construct( $server, $port=11211, $weight=0, $persistent_id=null, \Monolog\Logger $logger=null ) { |
|
| 46 | + public function __construct($server, $port = 11211, $weight = 0, $persistent_id = null, \Monolog\Logger $logger = null) { |
|
| 47 | 47 | |
| 48 | 48 | if ( empty($server) ) throw new CacheException("Invalid or unspecified memcached server"); |
| 49 | 49 | |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | try { |
| 84 | 84 | |
| 85 | - parent::__construct( $logger ); |
|
| 85 | + parent::__construct($logger); |
|
| 86 | 86 | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - catch ( CacheException $ce ) { |
|
| 89 | + catch (CacheException $ce) { |
|
| 90 | 90 | |
| 91 | 91 | throw $ce; |
| 92 | 92 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @return bool |
| 110 | 110 | * @throws \Comodojo\Exception\CacheException |
| 111 | 111 | */ |
| 112 | - public function set($name, $data, $ttl=null) { |
|
| 112 | + public function set($name, $data, $ttl = null) { |
|
| 113 | 113 | |
| 114 | 114 | if ( empty($name) ) throw new CacheException("Name of object cannot be empty"); |
| 115 | 115 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @return bool |
| 232 | 232 | * @throws \Comodojo\Exception\CacheException |
| 233 | 233 | */ |
| 234 | - public function delete($name=null) { |
|
| 234 | + public function delete($name = null) { |
|
| 235 | 235 | |
| 236 | 236 | if ( !$this->isEnabled() ) return false; |
| 237 | 237 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | $objects = 0; |
| 320 | 320 | |
| 321 | - foreach ($stats as $key => $value) { |
|
| 321 | + foreach ( $stats as $key => $value ) { |
|
| 322 | 322 | |
| 323 | 323 | $objects = max($objects, $value['curr_items']); |
| 324 | 324 | |
@@ -84,9 +84,7 @@ |
||
| 84 | 84 | |
| 85 | 85 | parent::__construct( $logger ); |
| 86 | 86 | |
| 87 | - } |
|
| 88 | - |
|
| 89 | - catch ( CacheException $ce ) { |
|
| 87 | + } catch ( CacheException $ce ) { |
|
| 90 | 88 | |
| 91 | 89 | throw $ce; |
| 92 | 90 | |