Passed
Pull Request — v6 (#815)
by Georges
06:50 queued 01:40
created
src/phpFastCache/Drivers/Devnull/Driver.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -127,9 +127,9 @@
 block discarded – undo
127 127
     {
128 128
         $stat = new DriverStatistic();
129 129
         $stat->setInfo('[Devnull] A void info string')
130
-          ->setSize(0)
131
-          ->setData(implode(', ', array_keys($this->itemInstances)))
132
-          ->setRawData(null);
130
+            ->setSize(0)
131
+            ->setData(implode(', ', array_keys($this->itemInstances)))
132
+            ->setRawData(null);
133 133
 
134 134
         return $stat;
135 135
     }
Please login to merge, or discard this patch.
src/phpFastCache/Entities/DriverStatistic.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -123,10 +123,10 @@
 block discarded – undo
123 123
     public function getPublicDesc()
124 124
     {
125 125
         return [
126
-          'Info' => 'Cache Information',
127
-          'Size' => 'Cache Size',
128
-          'Data' => 'Cache items keys',
129
-          'RawData' => 'Cache raw data',
126
+            'Info' => 'Cache Information',
127
+            'Size' => 'Cache Size',
128
+            'Data' => 'Cache items keys',
129
+            'RawData' => 'Cache raw data',
130 130
         ];
131 131
     }
132 132
 }
133 133
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Apcu/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -137,10 +137,10 @@
 block discarded – undo
137 137
         $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
138 138
 
139 139
         return (new DriverStatistic())
140
-          ->setData(implode(', ', array_keys($this->itemInstances)))
141
-          ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822),
140
+            ->setData(implode(', ', array_keys($this->itemInstances)))
141
+            ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822),
142 142
             $stats[ 'num_entries' ]))
143
-          ->setRawData($stats)
144
-          ->setSize($stats[ 'mem_size' ]);
143
+            ->setRawData($stats)
144
+            ->setSize($stats[ 'mem_size' ]);
145 145
     }
146 146
 }
147 147
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -133,14 +133,14 @@
 block discarded – undo
133 133
      */
134 134
     public function getStats()
135 135
     {
136
-        $stats = (array)apcu_cache_info();
137
-        $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
136
+        $stats = (array) apcu_cache_info();
137
+        $date = (new \DateTime())->setTimestamp($stats['start_time']);
138 138
 
139 139
         return (new DriverStatistic())
140 140
           ->setData(implode(', ', array_keys($this->itemInstances)))
141 141
           ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822),
142
-            $stats[ 'num_entries' ]))
142
+            $stats['num_entries']))
143 143
           ->setRawData($stats)
144
-          ->setSize($stats[ 'mem_size' ]);
144
+          ->setSize($stats['mem_size']);
145 145
     }
146 146
 }
147 147
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Zenddisk/Driver.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -147,9 +147,9 @@
 block discarded – undo
147 147
     {
148 148
         $stat = new DriverStatistic();
149 149
         $stat->setInfo('[ZendDisk] A void info string')
150
-          ->setSize(0)
151
-          ->setData(implode(', ', array_keys($this->itemInstances)))
152
-          ->setRawData(false);
150
+            ->setSize(0)
151
+            ->setData(implode(', ', array_keys($this->itemInstances)))
152
+            ->setRawData(false);
153 153
 
154 154
         return $stat;
155 155
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Cassandra/Driver.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
             try {
76 76
                 $cacheData = $this->encode($this->driverPreWrap($item));
77 77
                 $options = new Cassandra\ExecutionOptions([
78
-                  'arguments' => [
78
+                    'arguments' => [
79 79
                     'cache_uuid' => new Cassandra\Uuid(),
80 80
                     'cache_id' => $item->getKey(),
81 81
                     'cache_data' => $cacheData,
82 82
                     'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()),
83 83
                     'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()),
84 84
                     'cache_length' => strlen($cacheData),
85
-                  ],
86
-                  'consistency' => Cassandra::CONSISTENCY_ALL,
87
-                  'serial_consistency' => Cassandra::CONSISTENCY_SERIAL,
85
+                    ],
86
+                    'consistency' => Cassandra::CONSISTENCY_ALL,
87
+                    'serial_consistency' => Cassandra::CONSISTENCY_SERIAL,
88 88
                 ]);
89 89
 
90 90
                 $query = sprintf('INSERT INTO %s.%s
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
     {
123 123
         try {
124 124
             $options = new Cassandra\ExecutionOptions([
125
-              'arguments' => ['cache_id' => $item->getKey()],
126
-              'page_size' => 1,
125
+                'arguments' => ['cache_id' => $item->getKey()],
126
+                'page_size' => 1,
127 127
             ]);
128 128
             $query = sprintf(
129
-              'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
130
-              self::CASSANDRA_KEY_SPACE,
131
-              self::CASSANDRA_TABLE
129
+                'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
130
+                self::CASSANDRA_KEY_SPACE,
131
+                self::CASSANDRA_TABLE
132 132
             );
133 133
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
134 134
 
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
         if ($item instanceof Item) {
156 156
             try {
157 157
                 $options = new Cassandra\ExecutionOptions([
158
-                  'arguments' => [
158
+                    'arguments' => [
159 159
                     'cache_id' => $item->getKey(),
160
-                  ],
160
+                    ],
161 161
                 ]);
162 162
                 $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
163
-                  'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
164
-                  self::CASSANDRA_KEY_SPACE,
165
-                  self::CASSANDRA_TABLE
163
+                    'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
164
+                    self::CASSANDRA_KEY_SPACE,
165
+                    self::CASSANDRA_TABLE
166 166
                 )), $options);
167 167
 
168 168
                 /**
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
     {
187 187
         try {
188 188
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
189
-              'TRUNCATE %s.%s;',
190
-              self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
189
+                'TRUNCATE %s.%s;',
190
+                self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
191 191
             )));
192 192
 
193 193
             return true;
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
             $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
214 214
 
215 215
             $clusterBuilder = Cassandra::cluster()
216
-              ->withContactPoints($host)
217
-              ->withPort($port);
216
+                ->withContactPoints($host)
217
+                ->withPort($port);
218 218
 
219 219
             if (!empty($this->config[ 'ssl' ][ 'enabled' ])) {
220 220
                 if (!empty($this->config[ 'ssl' ][ 'verify' ])) {
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
              */
243 243
 
244 244
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
245
-              "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
246
-              self::CASSANDRA_KEY_SPACE
245
+                "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
246
+                self::CASSANDRA_KEY_SPACE
247 247
             )));
248 248
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf('USE %s;', self::CASSANDRA_KEY_SPACE)));
249 249
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf('
@@ -290,15 +290,15 @@  discard block
 block discarded – undo
290 290
     public function getStats()
291 291
     {
292 292
         $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
293
-          'SELECT SUM(cache_length) as cache_size FROM %s.%s',
294
-          self::CASSANDRA_KEY_SPACE,
295
-          self::CASSANDRA_TABLE
293
+            'SELECT SUM(cache_length) as cache_size FROM %s.%s',
294
+            self::CASSANDRA_KEY_SPACE,
295
+            self::CASSANDRA_TABLE
296 296
         )));
297 297
 
298 298
         return (new DriverStatistic())
299
-          ->setSize($result->first()[ 'cache_size' ])
300
-          ->setRawData([])
301
-          ->setData(implode(', ', array_keys($this->itemInstances)))
302
-          ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
299
+            ->setSize($result->first()[ 'cache_size' ])
300
+            ->setRawData([])
301
+            ->setData(implode(', ', array_keys($this->itemInstances)))
302
+            ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
303 303
     }
304 304
 }
305 305
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
134 134
 
135 135
             if ($results instanceof Cassandra\Rows && $results->count() === 1) {
136
-                return $this->decode($results->first()[ 'cache_data' ]);
136
+                return $this->decode($results->first()['cache_data']);
137 137
             } else {
138 138
                 return null;
139 139
             }
@@ -206,18 +206,18 @@  discard block
 block discarded – undo
206 206
         if ($this->instance instanceof CassandraSession) {
207 207
             throw new phpFastCacheLogicException('Already connected to Couchbase server');
208 208
         } else {
209
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
210
-            $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 9042;
211
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 2;
212
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
213
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
209
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
210
+            $port = isset($this->config['port']) ? $this->config['port'] : 9042;
211
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 2;
212
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
213
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
214 214
 
215 215
             $clusterBuilder = Cassandra::cluster()
216 216
               ->withContactPoints($host)
217 217
               ->withPort($port);
218 218
 
219
-            if (!empty($this->config[ 'ssl' ][ 'enabled' ])) {
220
-                if (!empty($this->config[ 'ssl' ][ 'verify' ])) {
219
+            if (!empty($this->config['ssl']['enabled'])) {
220
+                if (!empty($this->config['ssl']['verify'])) {
221 221
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_PEER_CERT);
222 222
                 } else {
223 223
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_NONE);
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         )));
297 297
 
298 298
         return (new DriverStatistic())
299
-          ->setSize($result->first()[ 'cache_size' ])
299
+          ->setSize($result->first()['cache_size'])
300 300
           ->setRawData([])
301 301
           ->setData(implode(', ', array_keys($this->itemInstances)))
302 302
           ->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.
src/phpFastCache/Drivers/Zendshm/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -147,9 +147,9 @@
 block discarded – undo
147 147
     {
148 148
         $stats = (array)zend_shm_cache_info();
149 149
         return (new DriverStatistic())
150
-          ->setData(implode(', ', array_keys($this->itemInstances)))
151
-          ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ]))
152
-          ->setRawData($stats)
153
-          ->setSize($stats[ 'memory_total' ]);
150
+            ->setData(implode(', ', array_keys($this->itemInstances)))
151
+            ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ]))
152
+            ->setRawData($stats)
153
+            ->setSize($stats[ 'memory_total' ]);
154 154
     }
155 155
 }
156 156
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -145,11 +145,11 @@
 block discarded – undo
145 145
      */
146 146
     public function getStats()
147 147
     {
148
-        $stats = (array)zend_shm_cache_info();
148
+        $stats = (array) zend_shm_cache_info();
149 149
         return (new DriverStatistic())
150 150
           ->setData(implode(', ', array_keys($this->itemInstances)))
151
-          ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ]))
151
+          ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total']))
152 152
           ->setRawData($stats)
153
-          ->setSize($stats[ 'memory_total' ]);
153
+          ->setSize($stats['memory_total']);
154 154
     }
155 155
 }
156 156
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Files/Driver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
              * Force write
77 77
              */
78 78
             try {
79
-                return $this->writefile($file_path, $data, $this->config[ 'secureFileManipulation' ]);
79
+                return $this->writefile($file_path, $data, $this->config['secureFileManipulation']);
80 80
             } catch (\Exception $e) {
81 81
                 return false;
82 82
             }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     protected function driverClear()
138 138
     {
139
-        return (bool)Directory::rrmdir($this->getPath(true));
139
+        return (bool) Directory::rrmdir($this->getPath(true));
140 140
     }
141 141
 
142 142
     /**
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Couchdb/Driver.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         if ($item instanceof Item) {
73 73
             try {
74 74
                 $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(),
75
-                  $this->getLatestDocumentRevision($item->getEncodedKey()));
75
+                    $this->getLatestDocumentRevision($item->getEncodedKey()));
76 76
             } catch (CouchDBException $e) {
77 77
                 throw new phpFastCacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e);
78 78
             }
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
             $url .= $path;
175 175
 
176 176
             $this->instance = CouchDBClient::create([
177
-              'dbname' => $this->getDatabaseName(),
178
-              'url' => $url,
179
-              'timeout' => $timeout,
177
+                'dbname' => $this->getDatabaseName(),
178
+                'url' => $url,
179
+                'timeout' => $timeout,
180 180
             ]);
181 181
 
182 182
             $this->createDatabase();
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
         $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId);
194 194
 
195 195
         $response = $this->instance->getHttpClient()->request(
196
-          'HEAD',
197
-          $path,
198
-          null,
199
-          false
196
+            'HEAD',
197
+            $path,
198
+            null,
199
+            false
200 200
         );
201 201
         if (!empty($response->headers[ 'etag' ])) {
202 202
             return trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B");
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
         $info = $this->instance->getDatabaseInfo();
251 251
 
252 252
         return (new DriverStatistic())
253
-          ->setSize($info[ 'sizes' ][ 'active' ])
254
-          ->setRawData($info)
255
-          ->setData(implode(', ', array_keys($this->itemInstances)))
256
-          ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
253
+            ->setSize($info[ 'sizes' ][ 'active' ])
254
+            ->setRawData($info)
255
+            ->setData(implode(', ', array_keys($this->itemInstances)))
256
+            ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
257 257
     }
258 258
 }
259 259
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
             throw new phpFastCacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e);
96 96
         }
97 97
 
98
-        if ($response->status === 404 || empty($response->body[ 'data' ])) {
98
+        if ($response->status === 404 || empty($response->body['data'])) {
99 99
             return null;
100 100
         } else if ($response->status === 200) {
101
-            return $this->decode($response->body[ 'data' ]);
101
+            return $this->decode($response->body['data']);
102 102
         } else {
103 103
             throw new phpFastCacheDriverException('Got unexpected HTTP status: ' . $response->status);
104 104
         }
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
         if ($this->instance instanceof CouchdbClient) {
154 154
             throw new phpFastCacheLogicException('Already connected to Couchdb server');
155 155
         } else {
156
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
157
-            $ssl = isset($this->config[ 'ssl' ]) ? $this->config[ 'ssl' ] : false;
158
-            $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 5984;
159
-            $path = isset($this->config[ 'path' ]) ? $this->config[ 'path' ] : '/';
160
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
161
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
162
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 10;
156
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
157
+            $ssl = isset($this->config['ssl']) ? $this->config['ssl'] : false;
158
+            $port = isset($this->config['port']) ? $this->config['port'] : 5984;
159
+            $path = isset($this->config['path']) ? $this->config['path'] : '/';
160
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
161
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
162
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 10;
163 163
 
164 164
             $url = ($ssl ? 'https://' : 'http://');
165 165
             if ($username) {
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
           null,
199 199
           false
200 200
         );
201
-        if (!empty($response->headers[ 'etag' ])) {
202
-            return trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B");
201
+        if (!empty($response->headers['etag'])) {
202
+            return trim($response->headers['etag'], " '\"\t\n\r\0\x0B");
203 203
         }
204 204
 
205 205
         return null;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     protected function getDatabaseName()
212 212
     {
213
-        return isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : 'phpfastcache';
213
+        return isset($this->config['database']) ? $this->config['database'] : 'phpfastcache';
214 214
     }
215 215
 
216 216
     /**
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         $info = $this->instance->getDatabaseInfo();
251 251
 
252 252
         return (new DriverStatistic())
253
-          ->setSize($info[ 'sizes' ][ 'active' ])
253
+          ->setSize($info['sizes']['active'])
254 254
           ->setRawData($info)
255 255
           ->setData(implode(', ', array_keys($this->itemInstances)))
256 256
           ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Leveldb/Driver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@
 block discarded – undo
125 125
             $this->instance->close();
126 126
             $this->instance = null;
127 127
         }
128
-        $result = (bool)LeveldbClient::destroy($this->getLeveldbFile());
128
+        $result = (bool) LeveldbClient::destroy($this->getLeveldbFile());
129 129
         $this->driverConnect();
130 130
 
131 131
         return $result;
Please login to merge, or discard this patch.