Completed
Push — v5 ( 0b505a...012ddd )
by Georges
02:41
created
src/phpFastCache/Drivers/Redis/Driver.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -175,9 +175,9 @@
 block discarded – undo
175 175
         $info = $this->instance->info();
176 176
         $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']);
177 177
         return (new driverStatistic())
178
-          ->setData(implode(', ', array_keys($this->itemInstances)))
179
-          ->setRawData($info)
180
-          ->setSize($info['used_memory'])
181
-          ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $info['redis_version'], $date->format(DATE_RFC2822)));
178
+            ->setData(implode(', ', array_keys($this->itemInstances)))
179
+            ->setRawData($info)
180
+            ->setSize($info['used_memory'])
181
+            ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $info['redis_version'], $date->format(DATE_RFC2822)));
182 182
     }
183 183
 }
184 184
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Mongodb/Driver.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
         if ($item instanceof Item) {
79 79
             try {
80 80
                 $result = (array) $this->getCollection()->update(
81
-                  ['_id' => $item->getKey()],
82
-                  [
81
+                    ['_id' => $item->getKey()],
82
+                    [
83 83
                     '$set' => [
84
-                      self::DRIVER_TIME_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : new MongoDate(time())),
85
-                      self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY),
86
-                      self::DRIVER_TAGS_WRAPPER_INDEX => new MongoBinData($this->encode($item->getTags()), MongoBinData::BYTE_ARRAY),
84
+                        self::DRIVER_TIME_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : new MongoDate(time())),
85
+                        self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY),
86
+                        self::DRIVER_TAGS_WRAPPER_INDEX => new MongoBinData($this->encode($item->getTags()), MongoBinData::BYTE_ARRAY),
87 87
                     ],
88
-                  ],
89
-                  ['upsert' => true, 'multiple' => false]
88
+                    ],
89
+                    ['upsert' => true, 'multiple' => false]
90 90
                 );
91 91
             } catch (MongoCursorException $e) {
92 92
                 return false;
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 
109 109
         if ($document) {
110 110
             return [
111
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
112
-              self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec),
113
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
111
+                self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
112
+                self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec),
113
+                self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
114 114
             ];
115 115
         } else {
116 116
             return null;
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
              * @todo make an url builder
166 166
              */
167 167
             $this->instance = $this->instance ?: (new MongodbClient('mongodb://' .
168
-              ($username ?: '') .
169
-              ($password ? ":{$password}" : '') .
170
-              ($username ? '@' : '') . "{$host}" .
171
-              ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache;
168
+                ($username ?: '') .
169
+                ($password ? ":{$password}" : '') .
170
+                ($username ? '@' : '') . "{$host}" .
171
+                ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache;
172 172
             // $this->instance->Cache->createIndex([self::DRIVER_TIME_WRAPPER_INDEX => 1], ['expireAfterSeconds' => 0]);
173 173
         }
174 174
     }
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
     public function getStats()
210 210
     {
211 211
         $serverStatus = $this->getCollection()->db->command([
212
-          'serverStatus' => 1,
213
-          'recordStats' => 0,
214
-          'repl' => 0,
215
-          'metrics' => 0,
212
+            'serverStatus' => 1,
213
+            'recordStats' => 0,
214
+            'repl' => 0,
215
+            'metrics' => 0,
216 216
         ]);
217 217
 
218 218
         $collStats = $this->getCollection()->db->command([
219
-          'collStats' => 'Cache',
220
-          'verbose' => true,
219
+            'collStats' => 'Cache',
220
+            'verbose' => true,
221 221
         ]);
222 222
 
223 223
         $stats = (new driverStatistic())
224
-          ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
225
-          ->setSize((int) $collStats[ 'size' ])
226
-          ->setData(implode(', ', array_keys($this->itemInstances)))
227
-          ->setRawData([
224
+            ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
225
+            ->setSize((int) $collStats[ 'size' ])
226
+            ->setData(implode(', ', array_keys($this->itemInstances)))
227
+            ->setRawData([
228 228
             'serverStatus' => $serverStatus,
229 229
             'collStats' => $collStats,
230
-          ]);
230
+            ]);
231 231
 
232 232
         return $stats;
233 233
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Predis/Driver.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
     public function driverConnect()
128 128
     {
129 129
         $server = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : [
130
-          'host' => '127.0.0.1',
131
-          'port' => '6379',
132
-          'password' => '',
133
-          'database' => '',
130
+            'host' => '127.0.0.1',
131
+            'port' => '6379',
132
+            'password' => '',
133
+            'database' => '',
134 134
         ];
135 135
 
136 136
         $config = [
137
-          'host' => $server[ 'host' ],
137
+            'host' => $server[ 'host' ],
138 138
         ];
139 139
 
140 140
         $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '';
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
     public function getStats()
197 197
     {
198 198
         return (new driverStatistic())
199
-          ->setRawData($this->instance->info())
200
-          ->setSize(0)
201
-          ->setInfo('');
199
+            ->setRawData($this->instance->info())
200
+            ->setSize(0)
201
+            ->setInfo('');
202 202
     }
203 203
 }
204 204
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Leveldb/Driver.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -176,9 +176,9 @@
 block discarded – undo
176 176
     public function getStats()
177 177
     {
178 178
         return (new driverStatistic())
179
-          ->setData(implode(', ', array_keys($this->itemInstances)))
180
-          ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($this->getLeveldbFile()))
181
-          ->setSize(Directory::dirSize($this->getLeveldbFile()));
179
+            ->setData(implode(', ', array_keys($this->itemInstances)))
180
+            ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($this->getLeveldbFile()))
181
+            ->setSize(Directory::dirSize($this->getLeveldbFile()));
182 182
     }
183 183
 
184 184
     /**
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Apc/Driver.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -154,9 +154,9 @@
 block discarded – undo
154 154
         $stats = (array) apc_cache_info('user');
155 155
         $date = (new \DateTime())->setTimestamp($stats['start_time']);
156 156
         return (new driverStatistic())
157
-          ->setData(implode(', ', array_keys($this->itemInstances)))
158
-          ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats['num_entries']))
159
-          ->setRawData($stats)
160
-          ->setSize($stats['mem_size']);
157
+            ->setData(implode(', ', array_keys($this->itemInstances)))
158
+            ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats['num_entries']))
159
+            ->setRawData($stats)
160
+            ->setSize($stats['mem_size']);
161 161
     }
162 162
 }
163 163
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Couchbase/Driver.php 1 patch
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 = $this->instance ?: new CouchbaseClient("couchbase://{$host}", $username, $password);
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
     {
210 210
         $info = $this->getBucket()->manager()->info();
211 211
         return (new driverStatistic())
212
-          ->setSize($info['basicStats']['diskUsed'])
213
-          ->setRawData($info)
214
-          ->setData(implode(', ', array_keys($this->itemInstances)))
215
-          ->setInfo('CouchBase version ' . $info[ 'nodes' ][0]['version'] . ', Uptime (in days): ' . round($info[ 'nodes' ][0][ 'uptime' ] / 86400, 1). "\n For more information see RawData.");
212
+            ->setSize($info['basicStats']['diskUsed'])
213
+            ->setRawData($info)
214
+            ->setData(implode(', ', array_keys($this->itemInstances)))
215
+            ->setInfo('CouchBase version ' . $info[ 'nodes' ][0]['version'] . ', Uptime (in days): ' . round($info[ 'nodes' ][0][ 'uptime' ] / 86400, 1). "\n For more information see RawData.");
216 216
     }
217 217
 }
218 218
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Memcache/Driver.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
132 132
         if (count($servers) < 1) {
133 133
             $servers = [
134
-              ['127.0.0.1', 11211],
134
+                ['127.0.0.1', 11211],
135 135
             ];
136 136
         }
137 137
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
         $stats = (array) $this->instance->getstats();
179 179
         $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']);
180 180
         return (new driverStatistic())
181
-          ->setData(implode(', ', array_keys($this->itemInstances)))
182
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822)))
183
-          ->setRawData($stats)
184
-          ->setSize($stats['bytes']);
181
+            ->setData(implode(', ', array_keys($this->itemInstances)))
182
+            ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822)))
183
+            ->setRawData($stats)
184
+            ->setSize($stats['bytes']);
185 185
     }
186 186
 }
187 187
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Sqlite/Driver.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
             $PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE);
153 153
             $PDO->setAttribute(PDO::ATTR_ERRMODE,
154
-              PDO::ERRMODE_EXCEPTION);
154
+                PDO::ERRMODE_EXCEPTION);
155 155
 
156 156
             if ($createTable == true) {
157 157
                 $this->initIndexing($PDO);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         // look for keyword
187 187
         $stm = $this->indexing->prepare("SELECT * FROM `balancing` WHERE `keyword`=:keyword LIMIT 1");
188 188
         $stm->execute([
189
-          ':keyword' => $keyword,
189
+            ':keyword' => $keyword,
190 190
         ]);
191 191
         $row = $stm->fetch(PDO::FETCH_ASSOC);
192 192
         if (isset($row[ 'db' ]) && $row[ 'db' ] != '') {
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
             $db = $this->currentDB;
199 199
             $stm = $this->indexing->prepare("INSERT INTO `balancing` (`keyword`,`db`) VALUES(:keyword, :db)");
200 200
             $stm->execute([
201
-              ':keyword' => $keyword,
202
-              ':db' => $db,
201
+                ':keyword' => $keyword,
202
+                ':db' => $db,
203 203
             ]);
204 204
         }
205 205
 
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
             if ($toWrite == true) {
271 271
                 try {
272 272
                     $stm = $this->getDb($item->getKey())
273
-                      ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)");
273
+                        ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)");
274 274
                     $stm->execute([
275
-                      ':keyword' => $item->getKey(),
276
-                      ':object' => $this->encode($this->driverPreWrap($item)),
277
-                      ':exp' => time() + $item->getTtl(),
275
+                        ':keyword' => $item->getKey(),
276
+                        ':object' => $this->encode($this->driverPreWrap($item)),
277
+                        ':exp' => time() + $item->getTtl(),
278 278
                     ]);
279 279
 
280 280
                     return true;
@@ -282,11 +282,11 @@  discard block
 block discarded – undo
282 282
 
283 283
                     try {
284 284
                         $stm = $this->getDb($item->getKey(), true)
285
-                          ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)");
285
+                            ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)");
286 286
                         $stm->execute([
287
-                          ':keyword' => $item->getKey(),
288
-                          ':object' => $this->encode($this->driverPreWrap($item)),
289
-                          ':exp' => time() + $item->getTtl(),
287
+                            ':keyword' => $item->getKey(),
288
+                            ':object' => $this->encode($this->driverPreWrap($item)),
289
+                            ':exp' => time() + $item->getTtl(),
290 290
                         ]);
291 291
                     } catch (PDOException $e) {
292 292
                         return false;
@@ -308,20 +308,20 @@  discard block
 block discarded – undo
308 308
     {
309 309
         try {
310 310
             $stm = $this->getDb($key)
311
-              ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U)  LIMIT 1");
311
+                ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U)  LIMIT 1");
312 312
             $stm->execute([
313
-              ':keyword' => $key,
314
-              ':U' => time(),
313
+                ':keyword' => $key,
314
+                ':U' => time(),
315 315
             ]);
316 316
             $row = $stm->fetch(PDO::FETCH_ASSOC);
317 317
 
318 318
         } catch (PDOException $e) {
319 319
             try {
320 320
                 $stm = $this->getDb($key, true)
321
-                  ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U)  LIMIT 1");
321
+                    ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U)  LIMIT 1");
322 322
                 $stm->execute([
323
-                  ':keyword' => $key,
324
-                  ':U' => time(),
323
+                    ':keyword' => $key,
324
+                    ':U' => time(),
325 325
                 ]);
326 326
                 $row = $stm->fetch(PDO::FETCH_ASSOC);
327 327
             } catch (PDOException $e) {
@@ -359,13 +359,13 @@  discard block
 block discarded – undo
359 359
         if ($item instanceof Item) {
360 360
             try {
361 361
                 $stm = $this->getDb($item->getKey())
362
-                  //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) ");
363
-                  ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) ");
362
+                    //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) ");
363
+                    ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) ");
364 364
 
365 365
                 return $stm->execute([
366 366
                     // ':id' => $row[ 'id' ],
367
-                  ':keyword' => $item->getKey(),
368
-                  ':U' => time(),
367
+                    ':keyword' => $item->getKey(),
368
+                    ':U' => time(),
369 369
                 ]);
370 370
             } catch (PDOException $e) {
371 371
                 return false;
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
              * @todo: Check expiration time here
424 424
              */
425 425
             $stm = $this->getDb($item->getKey())
426
-              ->prepare("SELECT COUNT(`id`) as `total` FROM `caching` WHERE (`keyword`=:keyword) AND (`exp` <= :U) ");
426
+                ->prepare("SELECT COUNT(`id`) as `total` FROM `caching` WHERE (`keyword`=:keyword) AND (`exp` <= :U) ");
427 427
             $stm->execute([
428
-              ':keyword' => $item->getKey(),
429
-              ':U' => time(),
428
+                ':keyword' => $item->getKey(),
429
+                ':U' => time(),
430 430
             ]);
431 431
             $data = $stm->fetch(PDO::FETCH_ASSOC);
432 432
             if ($data[ 'total' ] >= 1) {
@@ -459,9 +459,9 @@  discard block
 block discarded – undo
459 459
         }
460 460
 
461 461
         $stat->setData(implode(', ', array_keys($this->itemInstances)))
462
-          ->setRawData([])
463
-          ->setSize(Directory::dirSize($path))
464
-          ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
462
+            ->setRawData([])
463
+            ->setSize(Directory::dirSize($path))
464
+            ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
465 465
 
466 466
         return $stat;
467 467
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Files/Driver.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -254,9 +254,9 @@
 block discarded – undo
254 254
         }
255 255
 
256 256
         $stat->setData(implode(', ', array_keys($this->itemInstances)))
257
-          ->setRawData([])
258
-          ->setSize(Directory::dirSize($path))
259
-          ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
257
+            ->setRawData([])
258
+            ->setSize(Directory::dirSize($path))
259
+            ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
260 260
 
261 261
         return $stat;
262 262
     }
Please login to merge, or discard this patch.