Completed
Push — 2.0 ( f9aac1...beffc6 )
by Marco
13:31
created
src/Comodojo/Cache/Components/StackManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Comodojo/Cache/Components/NamespaceTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Comodojo/Cache/MemcachedCache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Comodojo/Cache/Cache.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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());
Please login to merge, or discard this patch.
src/Comodojo/Cache/PhpRedisCache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Comodojo/Cache/Providers/Memcached.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Comodojo/Cache/Providers/XCache.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Comodojo/Cache/Providers/PhpRedis.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Comodojo/Cache/Providers/Apc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.