Passed
Push — v7 ( 4ee131...ecaaea )
by Georges
01:49
created
lib/Phpfastcache/Drivers/Cassandra/Driver.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface};
21 21
 use Phpfastcache\Entities\DriverStatistic;
22 22
 use Phpfastcache\Exceptions\{
23
-  PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException
23
+    PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException
24 24
 };
25 25
 use Phpfastcache\Util\ArrayObject;
26 26
 use Psr\Cache\CacheItemInterface;
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
         $clientConfig = $this->getConfig();
62 62
 
63 63
         $clusterBuilder = Cassandra::cluster()
64
-          ->withContactPoints($clientConfig->getHost())
65
-          ->withPort($clientConfig->getPort());
64
+            ->withContactPoints($clientConfig->getHost())
65
+            ->withPort($clientConfig->getPort());
66 66
 
67 67
         if (!empty($clientConfig->isSslEnabled())) {
68 68
             if (!empty($clientConfig->isSslVerify())) {
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
          */
91 91
 
92 92
         $this->instance->execute(new Cassandra\SimpleStatement(\sprintf(
93
-          "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
94
-          self::CASSANDRA_KEY_SPACE
93
+            "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
94
+            self::CASSANDRA_KEY_SPACE
95 95
         )));
96 96
         $this->instance->execute(new Cassandra\SimpleStatement(\sprintf('USE %s;', self::CASSANDRA_KEY_SPACE)));
97 97
         $this->instance->execute(new Cassandra\SimpleStatement(\sprintf('
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
     {
118 118
         try {
119 119
             $options = new Cassandra\ExecutionOptions([
120
-              'arguments' => ['cache_id' => $item->getKey()],
121
-              'page_size' => 1,
120
+                'arguments' => ['cache_id' => $item->getKey()],
121
+                'page_size' => 1,
122 122
             ]);
123 123
             $query =\sprintf(
124
-              'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
125
-              self::CASSANDRA_KEY_SPACE,
126
-              self::CASSANDRA_TABLE
124
+                'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
125
+                self::CASSANDRA_KEY_SPACE,
126
+                self::CASSANDRA_TABLE
127 127
             );
128 128
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
129 129
 
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
             try {
152 152
                 $cacheData = $this->encode($this->driverPreWrap($item));
153 153
                 $options = new Cassandra\ExecutionOptions([
154
-                  'arguments' => [
154
+                    'arguments' => [
155 155
                     'cache_uuid' => new Cassandra\Uuid(),
156 156
                     'cache_id' => $item->getKey(),
157 157
                     'cache_data' => $cacheData,
158 158
                     'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()),
159 159
                     'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()),
160 160
                     'cache_length' => strlen($cacheData),
161
-                  ],
162
-                  'consistency' => Cassandra::CONSISTENCY_ALL,
163
-                  'serial_consistency' => Cassandra::CONSISTENCY_SERIAL,
161
+                    ],
162
+                    'consistency' => Cassandra::CONSISTENCY_ALL,
163
+                    'serial_consistency' => Cassandra::CONSISTENCY_SERIAL,
164 164
                 ]);
165 165
 
166 166
                 $query =\sprintf('INSERT INTO %s.%s
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
         if ($item instanceof Item) {
204 204
             try {
205 205
                 $options = new Cassandra\ExecutionOptions([
206
-                  'arguments' => [
206
+                    'arguments' => [
207 207
                     'cache_id' => $item->getKey(),
208
-                  ],
208
+                    ],
209 209
                 ]);
210 210
                 $result = $this->instance->execute(new Cassandra\SimpleStatement(\sprintf(
211
-                  'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
212
-                  self::CASSANDRA_KEY_SPACE,
213
-                  self::CASSANDRA_TABLE
211
+                    'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
212
+                    self::CASSANDRA_KEY_SPACE,
213
+                    self::CASSANDRA_TABLE
214 214
                 )), $options);
215 215
 
216 216
                 /**
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
     {
235 235
         try {
236 236
             $this->instance->execute(new Cassandra\SimpleStatement(\sprintf(
237
-              'TRUNCATE %s.%s;',
238
-              self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
237
+                'TRUNCATE %s.%s;',
238
+                self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
239 239
             )));
240 240
 
241 241
             return true;
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
     public function getStats(): DriverStatistic
273 273
     {
274 274
         $result = $this->instance->execute(new Cassandra\SimpleStatement(\sprintf(
275
-          'SELECT SUM(cache_length) as cache_size FROM %s.%s',
276
-          self::CASSANDRA_KEY_SPACE,
277
-          self::CASSANDRA_TABLE
275
+            'SELECT SUM(cache_length) as cache_size FROM %s.%s',
276
+            self::CASSANDRA_KEY_SPACE,
277
+            self::CASSANDRA_TABLE
278 278
         )));
279 279
 
280 280
         return (new DriverStatistic())
281
-          ->setSize($result->first()[ 'cache_size' ])
282
-          ->setRawData([])
283
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
284
-          ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
281
+            ->setSize($result->first()[ 'cache_size' ])
282
+            ->setRawData([])
283
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
284
+            ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
285 285
     }
286 286
 }
287 287
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Drivers\Cassandra;
17 17
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
               'arguments' => ['cache_id' => $item->getKey()],
121 121
               'page_size' => 1,
122 122
             ]);
123
-            $query =\sprintf(
123
+            $query = \sprintf(
124 124
               'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
125 125
               self::CASSANDRA_KEY_SPACE,
126 126
               self::CASSANDRA_TABLE
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
129 129
 
130 130
             if ($results instanceof Cassandra\Rows && $results->count() === 1) {
131
-                return $this->decode($results->first()[ 'cache_data' ]);
131
+                return $this->decode($results->first()['cache_data']);
132 132
             }
133 133
 
134 134
             return null;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                   'serial_consistency' => Cassandra::CONSISTENCY_SERIAL,
164 164
                 ]);
165 165
 
166
-                $query =\sprintf('INSERT INTO %s.%s
166
+                $query = \sprintf('INSERT INTO %s.%s
167 167
                     (
168 168
                       cache_uuid, 
169 169
                       cache_id, 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         )));
279 279
 
280 280
         return (new DriverStatistic())
281
-          ->setSize($result->first()[ 'cache_size' ])
281
+          ->setSize($result->first()['cache_size'])
282 282
           ->setRawData([])
283 283
           ->setData(\implode(', ', \array_keys($this->itemInstances)))
284 284
           ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Couchbase/Driver.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Drivers\Couchbase;
17 17
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
         }
78 78
 
79 79
         foreach ($clientConfig->getBuckets() as $bucket) {
80
-            $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ];
81
-            $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ]));
80
+            $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket'];
81
+            $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password']));
82 82
         }
83 83
 
84 84
         return true;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
          */
113 113
         if ($item instanceof Item) {
114 114
             try {
115
-                return (bool)$this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]);
115
+                return (bool) $this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]);
116 116
             } catch (\CouchbaseException $e) {
117 117
                 return false;
118 118
             }
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
          * Check for Cross-Driver type confusion
133 133
          */
134 134
         if ($item instanceof Item) {
135
-            try{
136
-                return (bool)$this->getBucket()->remove($item->getEncodedKey());
137
-            }catch (\Couchbase\Exception $e){
135
+            try {
136
+                return (bool) $this->getBucket()->remove($item->getEncodedKey());
137
+            } catch (\Couchbase\Exception $e) {
138 138
                 return $e->getCode() === COUCHBASE_KEY_ENOENT;
139 139
             }
140 140
         }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     protected function getBucket(): \CouchbaseBucket
158 158
     {
159
-        return $this->bucketInstances[ $this->bucketCurrent ];
159
+        return $this->bucketInstances[$this->bucketCurrent];
160 160
     }
161 161
 
162 162
     /**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket)
168 168
     {
169 169
         if (!\array_key_exists($bucketName, $this->bucketInstances)) {
170
-            $this->bucketInstances[ $bucketName ] = $CouchbaseBucket;
170
+            $this->bucketInstances[$bucketName] = $CouchbaseBucket;
171 171
         } else {
172 172
             throw new PhpfastcacheLogicException('A bucket instance with this name already exists.');
173 173
         }
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
         $info = $this->getBucket()->manager()->info();
188 188
 
189 189
         return (new DriverStatistic())
190
-          ->setSize($info[ 'basicStats' ][ 'diskUsed' ])
190
+          ->setSize($info['basicStats']['diskUsed'])
191 191
           ->setRawData($info)
192 192
           ->setData(\implode(', ', \array_keys($this->itemInstances)))
193
-          ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400,
193
+          ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400,
194 194
               1) . "\n For more information see RawData.");
195 195
     }
196 196
 }
197 197
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Ssdb/Driver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Drivers\Ssdb;
17 17
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
          * Data returned by Ssdb are very poorly formatted
147 147
          * using hardcoded offset of pair key-value :-(
148 148
          */
149
-        $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ]))
149
+        $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6]))
150 150
           ->setRawData($info)
151 151
           ->setData(\implode(', ', \array_keys($this->itemInstances)))
152 152
           ->setSize($this->instance->dbsize());
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Couchdb/Driver.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 namespace Phpfastcache\Drivers\Couchdb;
17 17
 
18 18
 use Doctrine\CouchDB\{
19
-  CouchDBClient as CouchdbClient, CouchDBException
19
+    CouchDBClient as CouchdbClient, CouchDBException
20 20
 };
21 21
 use Phpfastcache\Config\ConfigurationOption;
22 22
 use Phpfastcache\Core\Pool\{
23
-  DriverBaseTrait, ExtendedCacheItemPoolInterface
23
+    DriverBaseTrait, ExtendedCacheItemPoolInterface
24 24
 };
25 25
 use Phpfastcache\Exceptions\{
26
-  PhpfastcacheDriverException, PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException
26
+    PhpfastcacheDriverException, PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException
27 27
 };
28 28
 use Phpfastcache\Entities\DriverStatistic;
29 29
 use Phpfastcache\Util\ArrayObject;
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
         $url .= $clientConfig->getPath();
76 76
 
77 77
         $this->instance = CouchDBClient::create([
78
-          'dbname' => $this->getDatabaseName(),
79
-          'url' => $url,
80
-          'timeout' => $clientConfig->getTimeout(),
78
+            'dbname' => $this->getDatabaseName(),
79
+            'url' => $url,
80
+            'timeout' => $clientConfig->getTimeout(),
81 81
         ]);
82 82
 
83 83
         $this->createDatabase();
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         if ($item instanceof Item) {
125 125
             try {
126 126
                 $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(),
127
-                  $this->getLatestDocumentRevision($item->getEncodedKey()));
127
+                    $this->getLatestDocumentRevision($item->getEncodedKey()));
128 128
             } catch (CouchDBException $e) {
129 129
                 throw new PhpfastcacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e);
130 130
             }
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
         $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId);
182 182
 
183 183
         $response = $this->instance->getHttpClient()->request(
184
-          'HEAD',
185
-          $path,
186
-          null,
187
-          false
184
+            'HEAD',
185
+            $path,
186
+            null,
187
+            false
188 188
         );
189 189
         if (!empty($response->headers[ 'etag' ])) {
190 190
             return \trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B");
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
         $info = $this->instance->getDatabaseInfo();
239 239
 
240 240
         return (new DriverStatistic())
241
-          ->setSize($info[ 'sizes' ][ 'active' ])
242
-          ->setRawData($info)
243
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
244
-          ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
241
+            ->setSize($info[ 'sizes' ][ 'active' ])
242
+            ->setRawData($info)
243
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
244
+            ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
245 245
     }
246 246
 }
247 247
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Drivers\Couchdb;
17 17
 
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
             throw new PhpfastcacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e);
99 99
         }
100 100
 
101
-        if ($response->status === 404 || empty($response->body[ 'data' ])) {
101
+        if ($response->status === 404 || empty($response->body['data'])) {
102 102
             return null;
103 103
         }
104 104
 
105 105
         if ($response->status === 200) {
106
-            return $this->decode($response->body[ 'data' ]);
106
+            return $this->decode($response->body['data']);
107 107
         }
108 108
 
109 109
         throw new PhpfastcacheDriverException('Got unexpected HTTP status: ' . $response->status);
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
           null,
187 187
           false
188 188
         );
189
-        if (!empty($response->headers[ 'etag' ])) {
190
-            return \trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B");
189
+        if (!empty($response->headers['etag'])) {
190
+            return \trim($response->headers['etag'], " '\"\t\n\r\0\x0B");
191 191
         }
192 192
 
193 193
         return null;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         $info = $this->instance->getDatabaseInfo();
239 239
 
240 240
         return (new DriverStatistic())
241
-          ->setSize($info[ 'sizes' ][ 'active' ])
241
+          ->setSize($info['sizes']['active'])
242 242
           ->setRawData($info)
243 243
           ->setData(\implode(', ', \array_keys($this->itemInstances)))
244 244
           ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
Please login to merge, or discard this patch.