@@ -308,6 +308,9 @@ discard block |
||
| 308 | 308 | // public function getErrorMessage(); |
| 309 | 309 | |
| 310 | 310 | |
| 311 | + /** |
|
| 312 | + * @param string $name |
|
| 313 | + */ |
|
| 311 | 314 | private function getFromSingleProvider($selector, $name) { |
| 312 | 315 | |
| 313 | 316 | switch ($this->selector) { |
@@ -335,6 +338,9 @@ discard block |
||
| 335 | 338 | |
| 336 | 339 | } |
| 337 | 340 | |
| 341 | + /** |
|
| 342 | + * @param string $name |
|
| 343 | + */ |
|
| 338 | 344 | private function getFromAllProviders($name) { |
| 339 | 345 | |
| 340 | 346 | $data = array(); |
@@ -356,6 +362,9 @@ discard block |
||
| 356 | 362 | |
| 357 | 363 | } |
| 358 | 364 | |
| 365 | + /** |
|
| 366 | + * @param string $name |
|
| 367 | + */ |
|
| 359 | 368 | private function getTraverse($name) { |
| 360 | 369 | |
| 361 | 370 | $data; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - public function getProviders($enabled=false) { |
|
| 142 | + public function getProviders($enabled = false) { |
|
| 143 | 143 | |
| 144 | 144 | return $enabled ? $this->stack->getAll() : $this->stack->getAll(false); |
| 145 | 145 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | $set = array(); |
| 203 | 203 | |
| 204 | - foreach ($this->stack->getAll() as $id => $provider) { |
|
| 204 | + foreach ( $this->stack->getAll() as $id => $provider ) { |
|
| 205 | 205 | |
| 206 | 206 | $set[] = $provider->set($name, $data, $ttl); |
| 207 | 207 | |
@@ -235,13 +235,13 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - public function delete($name=null) { |
|
| 238 | + public function delete($name = null) { |
|
| 239 | 239 | |
| 240 | 240 | if ( !$this->isEnabled() ) return false; |
| 241 | 241 | |
| 242 | 242 | $delete = array(); |
| 243 | 243 | |
| 244 | - foreach ($this->stack->getAll() as $id => $provider) { |
|
| 244 | + foreach ( $this->stack->getAll() as $id => $provider ) { |
|
| 245 | 245 | |
| 246 | 246 | $delete[] = $provider->delete($name); |
| 247 | 247 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | $flush = array(); |
| 261 | 261 | |
| 262 | - foreach ($this->stack->getAll() as $id => $provider) { |
|
| 262 | + foreach ( $this->stack->getAll() as $id => $provider ) { |
|
| 263 | 263 | |
| 264 | 264 | $flush[] = $provider->flush(); |
| 265 | 265 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | if ( !$this->isEnabled() ) { |
| 279 | 279 | |
| 280 | - foreach ($this->stack->getAll(false) as $id => $provider) { |
|
| 280 | + foreach ( $this->stack->getAll(false) as $id => $provider ) { |
|
| 281 | 281 | $return[] = array( |
| 282 | 282 | "provider" => get_class($provider), |
| 283 | 283 | "enabled" => false, |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | } else { |
| 290 | 290 | |
| 291 | - foreach ($this->stack->getAll(false) as $id => $provider) { |
|
| 291 | + foreach ( $this->stack->getAll(false) as $id => $provider ) { |
|
| 292 | 292 | $return[] = $provider->status(); |
| 293 | 293 | } |
| 294 | 294 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | private function getFromSingleProvider($selector, $name) { |
| 312 | 312 | |
| 313 | - switch ($this->selector) { |
|
| 313 | + switch ( $this->selector ) { |
|
| 314 | 314 | |
| 315 | 315 | case 1: |
| 316 | 316 | $this->provider = $this->stack->getFirst(); |
@@ -341,14 +341,14 @@ discard block |
||
| 341 | 341 | |
| 342 | 342 | $providers = $this->stack->getAll(); |
| 343 | 343 | |
| 344 | - foreach ($providers as $id => $provider) { |
|
| 344 | + foreach ( $providers as $id => $provider ) { |
|
| 345 | 345 | $data[] = $this->provider->get($name); |
| 346 | 346 | if ( $this->provider->getErrorState() ) $this->stack->disable($this->provider->getCacheId()); |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | $values = array_unique(array_map('serialize', $data)); |
| 350 | 350 | |
| 351 | - if (count($values) == 1) { |
|
| 351 | + if ( count($values) == 1 ) { |
|
| 352 | 352 | return $data[0]; |
| 353 | 353 | } |
| 354 | 354 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | $providers = $this->stack->getAll(); |
| 364 | 364 | |
| 365 | - foreach ($providers as $id => $provider) { |
|
| 365 | + foreach ( $providers as $id => $provider ) { |
|
| 366 | 366 | $data = $this->provider->get($name); |
| 367 | 367 | if ( $this->provider->getErrorState() ) { |
| 368 | 368 | $this->stack->disable($this->provider->getCacheId()); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * Set a cache element using xattr |
| 68 | 68 | * |
| 69 | 69 | * @param string $name Name for cache element |
| 70 | - * @param mixed $data Data to cache |
|
| 70 | + * @param string $data Data to cache |
|
| 71 | 71 | * @param int $ttl Time to live |
| 72 | 72 | * |
| 73 | 73 | * @return bool |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * Set a cache element using ghost file |
| 111 | 111 | * |
| 112 | 112 | * @param string $name Name for cache element |
| 113 | - * @param mixed $data Data to cache |
|
| 113 | + * @param string $data Data to cache |
|
| 114 | 114 | * @param int $ttl Time to live |
| 115 | 115 | * |
| 116 | 116 | * @return bool |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param string $name Name for cache element |
| 156 | 156 | * @param int $time |
| 157 | 157 | * |
| 158 | - * @return mixed |
|
| 158 | + * @return string|null |
|
| 159 | 159 | */ |
| 160 | 160 | protected function getXattr($name, $time) { |
| 161 | 161 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * @param string $name Name for cache element |
| 214 | 214 | * @param int $time |
| 215 | 215 | * |
| 216 | - * @return mixed |
|
| 216 | + * @return string|null |
|
| 217 | 217 | */ |
| 218 | 218 | protected function getGhost($name, $time) { |
| 219 | 219 | |
@@ -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 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * THE SOFTWARE. |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | -class NullLogger implements LoggerInterface {
|
|
| 23 | +class NullLogger implements LoggerInterface { |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * emergency |
@@ -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 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | class XCache extends AbstractProvider { |
| 27 | 27 | |
| 28 | - /** |
|
| 28 | + /** |
|
| 29 | 29 | * Class constructor |
| 30 | 30 | * |
| 31 | 31 | * @param LoggerInterface $logger |
@@ -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 | |