Completed
Push — V6 ( 5d3acf...b4a639 )
by Georges
02:32
created
src/phpFastCache/Drivers/Couchbase/Driver.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
             $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
143 143
             $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
144 144
             $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [
145
-              [
145
+                [
146 146
                 'bucket' => 'default',
147 147
                 'password' => '',
148
-              ],
148
+                ],
149 149
             ];
150 150
 
151 151
             $this->instance = new CouchbaseClient("couchbase://{$host}", $username, $password);
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
         $info = $this->getBucket()->manager()->info();
196 196
 
197 197
         return (new driverStatistic())
198
-          ->setSize($info[ 'basicStats' ][ 'diskUsed' ])
199
-          ->setRawData($info)
200
-          ->setData(implode(', ', array_keys($this->itemInstances)))
201
-          ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData.");
198
+            ->setSize($info[ 'basicStats' ][ 'diskUsed' ])
199
+            ->setRawData($info)
200
+            ->setData(implode(', ', array_keys($this->itemInstances)))
201
+            ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData.");
202 202
     }
203 203
 }
204 204
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
         } else {
137 137
 
138 138
 
139
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
140
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
141
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
142
-            $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [
139
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
140
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
141
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
142
+            $buckets = isset($this->config['buckets']) ? $this->config['buckets'] : [
143 143
               [
144 144
                 'bucket' => 'default',
145 145
                 'password' => '',
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
             $this->instance = new CouchbaseClient("couchbase://{$host}", $username, $password);
150 150
 
151 151
             foreach ($buckets as $bucket) {
152
-                $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ];
153
-                $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ]));
152
+                $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket'];
153
+                $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password']));
154 154
             }
155 155
         }
156 156
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     protected function getBucket()
164 164
     {
165
-        return $this->bucketInstances[ $this->bucketCurrent ];
165
+        return $this->bucketInstances[$this->bucketCurrent];
166 166
     }
167 167
 
168 168
     /**
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket)
174 174
     {
175 175
         if (!array_key_exists($bucketName, $this->bucketInstances)) {
176
-            $this->bucketInstances[ $bucketName ] = $CouchbaseBucket;
176
+            $this->bucketInstances[$bucketName] = $CouchbaseBucket;
177 177
         } else {
178 178
             throw new phpFastCacheLogicException('A bucket instance with this name already exists.');
179 179
         }
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
         $info = $this->getBucket()->manager()->info();
194 194
 
195 195
         return (new driverStatistic())
196
-          ->setSize($info[ 'basicStats' ][ 'diskUsed' ])
196
+          ->setSize($info['basicStats']['diskUsed'])
197 197
           ->setRawData($info)
198 198
           ->setData(implode(', ', array_keys($this->itemInstances)))
199
-          ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData.");
199
+          ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, 1) . "\n For more information see RawData.");
200 200
     }
201 201
 }
202 202
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devfalse/Driver.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
     /**
64 64
      * @param \Psr\Cache\CacheItemInterface $item
65
-     * @return mixed
65
+     * @return boolean
66 66
      * @throws phpFastCacheInvalidArgumentException
67 67
      */
68 68
     protected function driverWrite(CacheItemInterface $item)
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
     protected function driverRead(CacheItemInterface $item)
81 81
     {
82 82
         return [
83
-          self::DRIVER_DATA_WRAPPER_INDEX => false,
84
-          self::DRIVER_TAGS_WRAPPER_INDEX => [],
85
-          self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(),
83
+            self::DRIVER_DATA_WRAPPER_INDEX => false,
84
+            self::DRIVER_TAGS_WRAPPER_INDEX => [],
85
+            self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(),
86 86
         ];
87 87
     }
88 88
     /**
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $stat = new driverStatistic();
133 133
         $stat->setInfo('[Devfalse] A void info string')
134
-          ->setSize(0)
135
-          ->setData(implode(', ', array_keys($this->itemInstances)))
136
-          ->setRawData(false);
134
+            ->setSize(0)
135
+            ->setData(implode(', ', array_keys($this->itemInstances)))
136
+            ->setRawData(false);
137 137
 
138 138
         return $stat;
139 139
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devtrue/Driver.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
     /**
64 64
      * @param \Psr\Cache\CacheItemInterface $item
65
-     * @return mixed
65
+     * @return boolean
66 66
      * @throws phpFastCacheInvalidArgumentException
67 67
      */
68 68
     protected function driverWrite(CacheItemInterface $item)
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
     protected function driverRead(CacheItemInterface $item)
81 81
     {
82 82
         return [
83
-          self::DRIVER_DATA_WRAPPER_INDEX => true,
84
-          self::DRIVER_TAGS_WRAPPER_INDEX => [],
85
-          self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(),
83
+            self::DRIVER_DATA_WRAPPER_INDEX => true,
84
+            self::DRIVER_TAGS_WRAPPER_INDEX => [],
85
+            self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(),
86 86
         ];
87 87
     }
88 88
 
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
     {
133 133
         $stat = new driverStatistic();
134 134
         $stat->setInfo('[Devtrue] A void info string')
135
-          ->setSize(0)
136
-          ->setData(implode(', ', array_keys($this->itemInstances)))
137
-          ->setRawData(true);
135
+            ->setSize(0)
136
+            ->setData(implode(', ', array_keys($this->itemInstances)))
137
+            ->setRawData(true);
138 138
 
139 139
         return $stat;
140 140
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Mongodb/Driver.php 3 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
         if ($item instanceof Item) {
88 88
             try {
89 89
                 $result = (array) $this->getCollection()->updateOne(
90
-                  ['_id' => $item->getEncodedKey()],
91
-                  [
90
+                    ['_id' => $item->getEncodedKey()],
91
+                    [
92 92
                     '$set' => [
93
-                      self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC),
94
-                      self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC),
95
-                      self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time()*1000)),
93
+                        self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC),
94
+                        self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC),
95
+                        self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time()*1000)),
96 96
                     ],
97
-                  ],
98
-                  ['upsert' => true, 'multiple' => false]
97
+                    ],
98
+                    ['upsert' => true, 'multiple' => false]
99 99
                 );
100 100
             } catch (MongoDBException $e) {
101 101
                 throw new phpFastCacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e);
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 
118 118
         if ($document) {
119 119
             return [
120
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()),
121
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()),
122
-              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()),
120
+                self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()),
121
+                self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()),
122
+                self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()),
123 123
             ];
124 124
         } else {
125 125
             return null;
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
              * @todo make an url builder
191 191
              */
192 192
             $this->instance = $this->instance ?: (new MongodbManager('mongodb://' .
193
-              ($username ?: '') .
194
-              ($password ? ":{$password}" : '') .
195
-              ($username ? '@' : '') . "{$host}" .
196
-              ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]));
193
+                ($username ?: '') .
194
+                ($password ? ":{$password}" : '') .
195
+                ($username ? '@' : '') . "{$host}" .
196
+                ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]));
197 197
             $this->collection = $this->collection ?: new Collection($this->instance,$databaseName, $collectionName);
198 198
 
199 199
             return true;
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
     public function getStats()
222 222
     {
223 223
         $serverStats = $this->instance->executeCommand('phpFastCache', new Command([
224
-          'serverStatus' => 1,
225
-          'recordStats' => 0,
226
-          'repl' => 0,
227
-          'metrics' => 0,
224
+            'serverStatus' => 1,
225
+            'recordStats' => 0,
226
+            'repl' => 0,
227
+            'metrics' => 0,
228 228
         ]))->toArray()[0];
229 229
 
230 230
         $collectionStats = $this->instance->executeCommand('phpFastCache', new Command([
231
-          'collStats' => (isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache'),
232
-          'verbose' => true,
231
+            'collStats' => (isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache'),
232
+            'verbose' => true,
233 233
         ]))->toArray()[0];
234 234
 
235 235
         $array_filter_recursive = function( $array, callable $callback = null ) use(&$array_filter_recursive) {
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
         $collectionStats = $array_filter_recursive($collectionStats, $callback);
260 260
 
261 261
         $stats = (new driverStatistic())
262
-          ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400, 1) . "\n For more information see RawData.")
263
-          ->setSize($collectionStats->size)
264
-          ->setData(implode(', ', array_keys($this->itemInstances)))
265
-          ->setRawData([
262
+            ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400, 1) . "\n For more information see RawData.")
263
+            ->setSize($collectionStats->size)
264
+            ->setData(implode(', ', array_keys($this->itemInstances)))
265
+            ->setRawData([
266 266
             'serverStatus' => $serverStats,
267 267
             'collStats' => $collectionStats,
268
-          ]);
268
+            ]);
269 269
 
270 270
         return $stats;
271 271
     }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 
77 77
     /**
78 78
      * @param \Psr\Cache\CacheItemInterface $item
79
-     * @return mixed
79
+     * @return boolean
80 80
      * @throws phpFastCacheInvalidArgumentException
81 81
      * @throws phpFastCacheDriverException
82 82
      */
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function driverCheck()
68 68
     {
69
-        if(!class_exists('MongoDB\Driver\Manager') && class_exists('MongoClient')){
69
+        if (!class_exists('MongoDB\Driver\Manager') && class_exists('MongoClient')) {
70 70
             trigger_error('This driver is used to support the pecl MongoDb extension with mongo-php-library.
71 71
             For MongoDb with Mongo PECL support use Mongo Driver.', E_USER_ERROR);
72 72
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                     '$set' => [
94 94
                       self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC),
95 95
                       self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC),
96
-                      self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time()*1000)),
96
+                      self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time() * 1000)),
97 97
                     ],
98 98
                   ],
99 99
                   ['upsert' => true, 'multiple' => false]
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                 throw new phpFastCacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e);
103 103
             }
104 104
 
105
-            return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true;
105
+            return isset($result['ok']) ? $result['ok'] == 1 : true;
106 106
         } else {
107 107
             throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected');
108 108
         }
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 
119 119
         if ($document) {
120 120
             return [
121
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()),
122
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()),
123
-              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()),
121
+              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->getData()),
122
+              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->getData()),
123
+              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_EDATE_WRAPPER_INDEX]->toDateTime()->getTimestamp()),
124 124
             ];
125 125
         } else {
126 126
             return null;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
          * @var \MongoDB\Model\BSONDocument $result
159 159
          */
160 160
         $result = $this->getCollection()->drop()->getArrayCopy();
161
-        $this->collection = new Collection($this->instance,'phpFastCache','Cache');
161
+        $this->collection = new Collection($this->instance, 'phpFastCache', 'Cache');
162 162
 
163 163
         /**
164 164
          * This will rebuild automatically the Collection indexes
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
         if ($this->instance instanceof \MongoDB\Driver\Manager) {
179 179
             throw new LogicException('Already connected to Mongodb server');
180 180
         } else {
181
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
182
-            $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '27017';
183
-            $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : 3;
184
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
185
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
186
-            $collectionName = isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache';
187
-            $databaseName = isset($this->config[ 'databaseName' ]) ? $this->config[ 'databaseName' ] : 'phpFastCache';
181
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
182
+            $port = isset($server['port']) ? $server['port'] : '27017';
183
+            $timeout = isset($server['timeout']) ? $server['timeout'] : 3;
184
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
185
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
186
+            $collectionName = isset($this->config['collectionName']) ? $this->config['collectionName'] : 'Cache';
187
+            $databaseName = isset($this->config['databaseName']) ? $this->config['databaseName'] : 'phpFastCache';
188 188
 
189 189
 
190 190
             /**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
               ($password ? ":{$password}" : '') .
196 196
               ($username ? '@' : '') . "{$host}" .
197 197
               ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]));
198
-            $this->collection = $this->collection ?: new Collection($this->instance,$databaseName, $collectionName);
198
+            $this->collection = $this->collection ?: new Collection($this->instance, $databaseName, $collectionName);
199 199
 
200 200
             return true;
201 201
         }
@@ -229,16 +229,16 @@  discard block
 block discarded – undo
229 229
         ]))->toArray()[0];
230 230
 
231 231
         $collectionStats = $this->instance->executeCommand('phpFastCache', new Command([
232
-          'collStats' => (isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache'),
232
+          'collStats' => (isset($this->config['collectionName']) ? $this->config['collectionName'] : 'Cache'),
233 233
           'verbose' => true,
234 234
         ]))->toArray()[0];
235 235
 
236
-        $array_filter_recursive = function( $array, callable $callback = null ) use(&$array_filter_recursive) {
236
+        $array_filter_recursive = function($array, callable $callback = null) use(&$array_filter_recursive) {
237 237
             $array = $callback($array);
238 238
 
239
-            if(is_object($array) ||is_array($array)){
240
-                foreach ( $array as &$value ) {
241
-                    $value = call_user_func( $array_filter_recursive, $value, $callback );
239
+            if (is_object($array) || is_array($array)) {
240
+                foreach ($array as &$value) {
241
+                    $value = call_user_func($array_filter_recursive, $value, $callback);
242 242
                 }
243 243
             }
244 244
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             /**
251 251
              * Remove unserializable properties
252 252
              */
253
-            if($item instanceof \MongoDB\BSON\UTCDateTime){
253
+            if ($item instanceof \MongoDB\BSON\UTCDateTime) {
254 254
                 return (string) $item;
255 255
             }
256 256
             return $item;
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Couchdb/Driver.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
             $url .= $path;
174 174
 
175 175
             $this->instance = CouchDBClient::create([
176
-              'dbname' => $this->getDatabaseName(),
177
-              'url' => $url,
178
-              'timeout' => $timeout
176
+                'dbname' => $this->getDatabaseName(),
177
+                'url' => $url,
178
+                'timeout' => $timeout
179 179
             ]);
180 180
 
181 181
             $this->createDatabase();
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
         $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId);
193 193
 
194 194
         $response = $this->instance->getHttpClient()->request(
195
-          'GET',// At this moment HEAD requests are not working: https://github.com/doctrine/couchdb-client/issues/72
196
-          $path,
197
-          null,
198
-          false
195
+            'GET',// At this moment HEAD requests are not working: https://github.com/doctrine/couchdb-client/issues/72
196
+            $path,
197
+            null,
198
+            false
199 199
         );
200 200
         if(!empty($response->headers['etag'])){
201 201
             return trim($response->headers['etag'], " '\"\t\n\r\0\x0B");
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
         $info = $this->instance->getDatabaseInfo();
237 237
 
238 238
         return (new driverStatistic())
239
-          ->setSize($info['sizes']['active'])
240
-          ->setRawData($info)
241
-          ->setData(implode(', ', array_keys($this->itemInstances)))
242
-          ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
239
+            ->setSize($info['sizes']['active'])
240
+            ->setRawData($info)
241
+            ->setData(implode(', ', array_keys($this->itemInstances)))
242
+            ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
243 243
     }
244 244
 }
245 245
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         if ($item instanceof Item) {
72 72
             try{
73 73
                 $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey()));
74
-            }catch (CouchDBException $e){
74
+            } catch (CouchDBException $e){
75 75
                 throw new phpFastCacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e);
76 76
             }
77 77
             return true;
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
     {
90 90
         try{
91 91
             $response = $this->instance->findDocument($item->getEncodedKey());
92
-        }catch (CouchDBException $e){
92
+        } catch (CouchDBException $e){
93 93
             throw new phpFastCacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e);
94 94
         }
95 95
 
96 96
         if($response->status === 404 || empty($response->body['data'])){
97 97
             return null;
98
-        }else if($response->status === 200){
98
+        } else if($response->status === 200){
99 99
             return $this->decode($response->body['data']);
100
-        }else{
100
+        } else{
101 101
             throw new phpFastCacheDriverException('Got unexpected HTTP status: ' . $response->status);
102 102
         }
103 103
     }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         if ($item instanceof Item) {
117 117
             try{
118 118
                 $this->instance->deleteDocument($item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey()));
119
-            }catch (CouchDBException $e){
119
+            } catch (CouchDBException $e){
120 120
                 throw new phpFastCacheDriverException('Got error while trying to delete a document: ' . $e->getMessage(), null, $e);
121 121
             }
122 122
             return true;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         try{
135 135
             $this->instance->deleteDatabase($this->getDatabaseName());
136 136
             $this->createDatabase();
137
-        }catch (CouchDBException $e){
137
+        } catch (CouchDBException $e){
138 138
             throw new phpFastCacheDriverException('Got error while trying to delete and recreate the database: ' . $e->getMessage(), null, $e);
139 139
         }
140 140
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         );
200 200
         if(!empty($response->headers['etag'])){
201 201
             return trim($response->headers['etag'], " '\"\t\n\r\0\x0B");
202
-        }else{
202
+        } else{
203 203
             return null;
204 204
         }
205 205
     }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
          * Check for Cross-Driver type confusion
71 71
          */
72 72
         if ($item instanceof Item) {
73
-            try{
73
+            try {
74 74
                 $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey()));
75
-            }catch (CouchDBException $e){
75
+            } catch (CouchDBException $e) {
76 76
                 throw new phpFastCacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e);
77 77
             }
78 78
             return true;
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
      */
89 89
     protected function driverRead(CacheItemInterface $item)
90 90
     {
91
-        try{
91
+        try {
92 92
             $response = $this->instance->findDocument($item->getEncodedKey());
93
-        }catch (CouchDBException $e){
93
+        } catch (CouchDBException $e) {
94 94
             throw new phpFastCacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e);
95 95
         }
96 96
 
97
-        if($response->status === 404 || empty($response->body['data'])){
97
+        if ($response->status === 404 || empty($response->body['data'])) {
98 98
             return null;
99
-        }else if($response->status === 200){
99
+        } else if ($response->status === 200) {
100 100
             return $this->decode($response->body['data']);
101
-        }else{
101
+        } else {
102 102
             throw new phpFastCacheDriverException('Got unexpected HTTP status: ' . $response->status);
103 103
         }
104 104
     }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
          * Check for Cross-Driver type confusion
116 116
          */
117 117
         if ($item instanceof Item) {
118
-            try{
118
+            try {
119 119
                 $this->instance->deleteDocument($item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey()));
120
-            }catch (CouchDBException $e){
120
+            } catch (CouchDBException $e) {
121 121
                 throw new phpFastCacheDriverException('Got error while trying to delete a document: ' . $e->getMessage(), null, $e);
122 122
             }
123 123
             return true;
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
      */
133 133
     protected function driverClear()
134 134
     {
135
-        try{
135
+        try {
136 136
             $this->instance->deleteDatabase($this->getDatabaseName());
137 137
             $this->createDatabase();
138
-        }catch (CouchDBException $e){
138
+        } catch (CouchDBException $e) {
139 139
             throw new phpFastCacheDriverException('Got error while trying to delete and recreate the database: ' . $e->getMessage(), null, $e);
140 140
         }
141 141
 
@@ -152,19 +152,19 @@  discard block
 block discarded – undo
152 152
         if ($this->instance instanceof CouchdbClient) {
153 153
             throw new phpFastCacheLogicException('Already connected to Couchdb server');
154 154
         } else {
155
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
156
-            $ssl = isset($this->config[ 'ssl' ]) ? $this->config[ 'ssl' ] : false;
157
-            $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 5984;
158
-            $path = isset($this->config[ 'path' ]) ? $this->config[ 'path' ] : '/';
159
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
160
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
161
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 10;
155
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
156
+            $ssl = isset($this->config['ssl']) ? $this->config['ssl'] : false;
157
+            $port = isset($this->config['port']) ? $this->config['port'] : 5984;
158
+            $path = isset($this->config['path']) ? $this->config['path'] : '/';
159
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
160
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
161
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 10;
162 162
 
163 163
             $url = ($ssl ? 'https://' : 'http://');
164
-            if($username)
164
+            if ($username)
165 165
             {
166 166
                 $url .= "{$username}";
167
-                if($password)
167
+                if ($password)
168 168
                 {
169 169
                     $url .= ":{$password}";
170 170
                 }
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
         $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId);
195 195
 
196 196
         $response = $this->instance->getHttpClient()->request(
197
-          'GET',// At this moment HEAD requests are not working: https://github.com/doctrine/couchdb-client/issues/72
197
+          'GET', // At this moment HEAD requests are not working: https://github.com/doctrine/couchdb-client/issues/72
198 198
           $path,
199 199
           null,
200 200
           false
201 201
         );
202
-        if(!empty($response->headers['etag'])){
202
+        if (!empty($response->headers['etag'])) {
203 203
             return trim($response->headers['etag'], " '\"\t\n\r\0\x0B");
204
-        }else{
204
+        } else {
205 205
             return null;
206 206
         }
207 207
     }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      */
212 212
     protected function getDatabaseName()
213 213
     {
214
-        return isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : 'phpfastcache';
214
+        return isset($this->config['database']) ? $this->config['database'] : 'phpfastcache';
215 215
     }
216 216
 
217 217
     /**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      */
220 220
     protected function createDatabase()
221 221
     {
222
-        if(!in_array($this->instance->getDatabase(), $this->instance->getAllDatabases(), true)){
222
+        if (!in_array($this->instance->getDatabase(), $this->instance->getAllDatabases(), true)) {
223 223
             $this->instance->createDatabase($this->instance->getDatabase());
224 224
         }
225 225
     }
Please login to merge, or discard this patch.
src/phpFastCache/Helper/TestHelper.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function printNewLine($count = 1)
97 97
     {
98
-        for($i = 0; $i < $count; $i++){
98
+        for ($i = 0; $i < $count; $i++) {
99 99
             print PHP_EOL;
100 100
         }
101 101
 
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function printText($string, $strtoupper = false)
111 111
     {
112
-        if(!$strtoupper){
112
+        if (!$strtoupper) {
113 113
             print trim($string) . PHP_EOL;
114
-        }else{
114
+        } else {
115 115
             print strtoupper(trim($string) . PHP_EOL);
116 116
         }
117 117
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function runAsyncProcess($cmd)
125 125
     {
126
-        if (substr(php_uname(), 0, 7) === 'Windows'){
127
-            pclose(popen('start /B '. $cmd, 'r'));
126
+        if (substr(php_uname(), 0, 7) === 'Windows') {
127
+            pclose(popen('start /B ' . $cmd, 'r'));
128 128
         }
129 129
         else {
130 130
             exec($cmd . ' > /dev/null &');
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         if(!$strtoupper){
113 113
             print trim($string) . PHP_EOL;
114
-        }else{
114
+        } else{
115 115
             print strtoupper(trim($string) . PHP_EOL);
116 116
         }
117 117
 
@@ -125,8 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         if (substr(php_uname(), 0, 7) === 'Windows'){
127 127
             pclose(popen('start /B '. $cmd, 'r'));
128
-        }
129
-        else {
128
+        } else {
130 129
             exec($cmd . ' > /dev/null &');
131 130
         }
132 131
     }
Please login to merge, or discard this patch.
src/phpFastCache/Entities/ItemBatch.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@
 block discarded – undo
39 39
      */
40 40
     public function __construct($itemKey, \DateTime $itemDate)
41 41
     {
42
-        if(is_string($itemKey)){
42
+        if (is_string($itemKey)) {
43 43
             $this->itemKey = $itemKey;
44 44
             $this->itemDate = $itemDate;
45
-        }else{
45
+        } else {
46 46
             throw new phpFastCacheInvalidArgumentException(sprintf('$itemKey must be a string, got "%s" instead', gettype($itemKey)));
47 47
         }
48 48
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
         if(is_string($itemKey)){
43 43
             $this->itemKey = $itemKey;
44 44
             $this->itemDate = $itemDate;
45
-        }else{
45
+        } else{
46 46
             throw new phpFastCacheInvalidArgumentException(sprintf('$itemKey must be a string, got "%s" instead', gettype($itemKey)));
47 47
         }
48 48
     }
Please login to merge, or discard this patch.
src/phpFastCache/Core/Item/ItemExtendedTrait.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $keyHashFunction = $this->driver->getConfigOption('defaultKeyHashFunction');
52 52
 
53
-        if($keyHashFunction){
53
+        if ($keyHashFunction) {
54 54
             return $keyHashFunction($this->getKey());
55
-        }else{
55
+        } else {
56 56
             return md5($this->getKey());
57 57
         }
58 58
     }
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function getCreationDate()
98 98
     {
99
-        if($this->driver->getConfig()['itemDetailedDate']){
99
+        if ($this->driver->getConfig()['itemDetailedDate']) {
100 100
             return $this->creationDate;
101
-        }else{
101
+        } else {
102 102
             throw new phpFastCacheLogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
103 103
         }
104 104
     }
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function setCreationDate(\DateTimeInterface $date)
112 112
     {
113
-        if($this->driver->getConfig()['itemDetailedDate']){
113
+        if ($this->driver->getConfig()['itemDetailedDate']) {
114 114
             $this->creationDate = $date;
115 115
             return $this;
116
-        }else{
116
+        } else {
117 117
             throw new phpFastCacheLogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
118 118
         }
119 119
     }
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function getModificationDate()
126 126
     {
127
-        if($this->driver->getConfig()['itemDetailedDate']){
127
+        if ($this->driver->getConfig()['itemDetailedDate']) {
128 128
             return $this->modificationDate;
129
-        }else{
129
+        } else {
130 130
             throw new phpFastCacheLogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
131 131
         }
132 132
     }
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public function setModificationDate(\DateTimeInterface $date)
140 140
     {
141
-        if($this->driver->getConfig()['itemDetailedDate']){
141
+        if ($this->driver->getConfig()['itemDetailedDate']) {
142 142
             $this->modificationDate = $date;
143 143
             return $this;
144
-        }else{
144
+        } else {
145 145
             throw new phpFastCacheLogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
146 146
         }
147 147
     }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     public function removeTag($tagName)
310 310
     {
311 311
         if (($key = array_search($tagName, $this->tags)) !== false) {
312
-            unset($this->tags[ $key ]);
312
+            unset($this->tags[$key]);
313 313
             $this->removedTags[] = $tagName;
314 314
         }
315 315
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
     final public function __debugInfo()
389 389
     {
390 390
         $info = get_object_vars($this);
391
-        $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')';
391
+        $info['driver'] = 'object(' . get_class($info['driver']) . ')';
392 392
 
393 393
         return (array) $info;
394 394
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
         if($keyHashFunction){
54 54
             return $keyHashFunction($this->getKey());
55
-        }else{
55
+        } else{
56 56
             return md5($this->getKey());
57 57
         }
58 58
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         if($this->driver->getConfig()['itemDetailedDate']){
100 100
             return $this->creationDate;
101
-        }else{
101
+        } else{
102 102
             throw new phpFastCacheLogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
103 103
         }
104 104
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         if($this->driver->getConfig()['itemDetailedDate']){
114 114
             $this->creationDate = $date;
115 115
             return $this;
116
-        }else{
116
+        } else{
117 117
             throw new phpFastCacheLogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
118 118
         }
119 119
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     {
127 127
         if($this->driver->getConfig()['itemDetailedDate']){
128 128
             return $this->modificationDate;
129
-        }else{
129
+        } else{
130 130
             throw new phpFastCacheLogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
131 131
         }
132 132
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         if($this->driver->getConfig()['itemDetailedDate']){
142 142
             $this->modificationDate = $date;
143 143
             return $this;
144
-        }else{
144
+        } else{
145 145
             throw new phpFastCacheLogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
146 146
         }
147 147
     }
Please login to merge, or discard this patch.