Test Failed
Branch final (67960f)
by Georges
02:28
created
src/autoload.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
 /**
18 18
  * Register Autoload
19 19
  */
20
-spl_autoload_register(function ($entity) {
20
+spl_autoload_register(function($entity) {
21 21
     $module = explode('\\', $entity, 2);
22
-    if (!in_array($module[ 0 ], ['phpFastCache', 'Psr'])) {
22
+    if (!in_array($module[0], ['phpFastCache', 'Psr'])) {
23 23
         /**
24 24
          * Not a part of phpFastCache file
25 25
          * then we return here.
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,5 +56,5 @@
 block discarded – undo
56 56
 
57 57
 if ((!defined('PFC_IGNORE_COMPOSER_WARNING') || !PFC_IGNORE_COMPOSER_WARNING) && class_exists('Composer\Autoload\ClassLoader')) {
58 58
     trigger_error('Your project already makes use of Composer. You SHOULD use the composer dependency "phpfastcache/phpfastcache" instead of hard-autoloading.',
59
-      E_USER_WARNING);
59
+        E_USER_WARNING);
60 60
 }
61 61
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/CacheManager.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     }
171 171
 
172 172
     /**
173
-     * @return array
173
+     * @return string[]
174 174
      */
175 175
     public static function getStaticSystemDrivers()
176 176
     {
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     }
195 195
 
196 196
     /**
197
-     * @return array
197
+     * @return string[]
198 198
      */
199 199
     public static function getStaticAllDrivers()
200 200
     {
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -65,101 +65,101 @@  discard block
 block discarded – undo
65 65
         /**
66 66
          * Specify if the item must provide detailed creation/modification dates
67 67
          */
68
-      'itemDetailedDate' => false,
68
+        'itemDetailedDate' => false,
69 69
 
70 70
         /**
71 71
          * Automatically attempt to fallback to temporary directory
72 72
          * if the cache fails to write on the specified directory
73 73
          */
74
-      'autoTmpFallback' => false,
74
+        'autoTmpFallback' => false,
75 75
 
76 76
         /**
77 77
          * Provide a secure file manipulation mechanism,
78 78
          * on intensive usage the performance can be affected.
79 79
          */
80
-      'secureFileManipulation' => false,
80
+        'secureFileManipulation' => false,
81 81
 
82 82
         /**
83 83
          * Ignore Symfony notice for Symfony project which
84 84
          * do not makes use of PhpFastCache's Symfony Bundle
85 85
          */
86
-      'ignoreSymfonyNotice' => false,
86
+        'ignoreSymfonyNotice' => false,
87 87
 
88 88
         /**
89 89
          * Default time-to-live in second
90 90
          */
91
-      'defaultTtl' => 900,
91
+        'defaultTtl' => 900,
92 92
 
93 93
         /**
94 94
          * Default key hash function
95 95
          * (md5 by default)
96 96
          */
97
-      'defaultKeyHashFunction' => '',
97
+        'defaultKeyHashFunction' => '',
98 98
 
99 99
         /**
100 100
          * The securityKey that will be used
101 101
          * to create sub-directory
102 102
          * (Files-based drivers only)
103 103
          */
104
-      'securityKey' => 'Auto',
104
+        'securityKey' => 'Auto',
105 105
 
106 106
         /**
107 107
          * Auto-generate .htaccess if it's missing
108 108
          * (Files-based drivers only)
109 109
          */
110
-      'htaccess' => true,
110
+        'htaccess' => true,
111 111
 
112 112
         /**
113 113
          * Default files chmod
114 114
          * 0777 recommended
115 115
          * (Files-based drivers only)
116 116
          */
117
-      'default_chmod' => 0777,
117
+        'default_chmod' => 0777,
118 118
 
119 119
         /**
120 120
          * The path where we will writecache files
121 121
          * default value if empty: sys_get_temp_dir()
122 122
          * (Files-based drivers only)
123 123
          */
124
-      'path' => '',
124
+        'path' => '',
125 125
 
126 126
         /**
127 127
          * Driver fallback in case of failure.
128 128
          * Caution, in case of failure an E_WARNING
129 129
          * error will always be raised
130 130
          */
131
-      'fallback' => false,
131
+        'fallback' => false,
132 132
 
133 133
         /**
134 134
          * Maximum size (bytes) of object store in memory
135 135
          * (Memcache(d) drivers only)
136 136
          */
137
-      'limited_memory_each_object' => 4096,
137
+        'limited_memory_each_object' => 4096,
138 138
 
139 139
         /**
140 140
          * Compress stored data, if the backend supports it
141 141
          * (Memcache(d) drivers only)
142 142
          */
143
-      'compress_data' => false,
143
+        'compress_data' => false,
144 144
 
145 145
         /**
146 146
          * Prevent cache slams when
147 147
          * making use of heavy cache
148 148
          * items
149 149
          */
150
-      'preventCacheSlams' => false,
150
+        'preventCacheSlams' => false,
151 151
 
152 152
         /**
153 153
          * Cache slams timeout
154 154
          * in seconds
155 155
          */
156
-      'cacheSlamsTimeout' => 15,
156
+        'cacheSlamsTimeout' => 15,
157 157
 
158 158
         /**
159 159
          * Cache slams timeout
160 160
          * in seconds
161 161
          */
162
-      'cacheFileExtension' => 'txt',
162
+        'cacheFileExtension' => 'txt',
163 163
 
164 164
     ];
165 165
 
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
      * @var array
170 170
      */
171 171
     protected static $safeFileExtensions = [
172
-      'txt',
173
-      'cache',
174
-      'db',
175
-      'pfc',
172
+        'txt',
173
+        'cache',
174
+        'db',
175
+        'pfc',
176 176
     ];
177 177
 
178 178
     /**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $badPracticeOmeter[ $driver ] = 1;
212 212
             if (!$config[ 'ignoreSymfonyNotice' ] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) {
213 213
                 trigger_error('A Symfony Bundle to make the PhpFastCache integration more easier is now available here: https://github.com/PHPSocialNetwork/phpfastcache-bundle',
214
-                  E_USER_NOTICE);
214
+                    E_USER_NOTICE);
215 215
             }
216 216
             $class = self::getNamespacePath() . $driver . '\Driver';
217 217
             try {
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                             self::$instances[ $instance ] = new $class($config);
227 227
                             self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
228 228
                             trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver,
229
-                              $fallback), E_USER_WARNING);
229
+                                $fallback), E_USER_WARNING);
230 230
                         } else {
231 231
                             throw new phpFastCacheInvalidConfigurationException('The fallback driver cannot be the same than the default driver', 0, $e);
232 232
                         }
@@ -379,24 +379,24 @@  discard block
 block discarded – undo
379 379
     public static function getStaticSystemDrivers()
380 380
     {
381 381
         return [
382
-          'Apc',
383
-          'Apcu',
384
-          'Cassandra',
385
-          'Couchbase',
386
-          'Couchdb',
387
-          'Devnull',
388
-          'Files',
389
-          'Leveldb',
390
-          'Memcache',
391
-          'Memcached',
392
-          'Memstatic',
393
-          'Mongodb',
394
-          'Predis',
395
-          'Redis',
396
-          'Ssdb',
397
-          'Sqlite',
398
-          'Wincache',
399
-          'Xcache',
382
+            'Apc',
383
+            'Apcu',
384
+            'Cassandra',
385
+            'Couchbase',
386
+            'Couchdb',
387
+            'Devnull',
388
+            'Files',
389
+            'Leveldb',
390
+            'Memcache',
391
+            'Memcached',
392
+            'Memstatic',
393
+            'Mongodb',
394
+            'Predis',
395
+            'Redis',
396
+            'Ssdb',
397
+            'Sqlite',
398
+            'Wincache',
399
+            'Xcache',
400 400
         ];
401 401
     }
402 402
 
@@ -406,9 +406,9 @@  discard block
 block discarded – undo
406 406
     public static function getStaticAllDrivers()
407 407
     {
408 408
         return array_merge(self::getStaticSystemDrivers(), [
409
-          'Devtrue',
410
-          'Devfalse',
411
-          'Cookie',
409
+            'Devtrue',
410
+            'Devfalse',
411
+            'Cookie',
412 412
         ]);
413 413
     }
414 414
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                     }
510 510
                     if (!in_array($configValue, self::$safeFileExtensions)) {
511 511
                         throw new phpFastCacheInvalidConfigurationException(
512
-                          "{$configName} is not a safe extension, currently allowed extension: " . implode(', ', self::$safeFileExtensions)
512
+                            "{$configName} is not a safe extension, currently allowed extension: " . implode(', ', self::$safeFileExtensions)
513 513
                         );
514 514
                     }
515 515
                     break;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -207,24 +207,24 @@  discard block
 block discarded – undo
207 207
         }
208 208
 
209 209
         $instance = crc32($driver . serialize($config));
210
-        if (!isset(self::$instances[ $instance ])) {
211
-            $badPracticeOmeter[ $driver ] = 1;
212
-            if (!$config[ 'ignoreSymfonyNotice' ] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) {
210
+        if (!isset(self::$instances[$instance])) {
211
+            $badPracticeOmeter[$driver] = 1;
212
+            if (!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) {
213 213
                 trigger_error('A Symfony Bundle to make the PhpFastCache integration more easier is now available here: https://github.com/PHPSocialNetwork/phpfastcache-bundle',
214 214
                   E_USER_NOTICE);
215 215
             }
216 216
             $class = self::getNamespacePath() . $driver . '\Driver';
217 217
             try {
218
-                self::$instances[ $instance ] = new $class($config);
219
-                self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
218
+                self::$instances[$instance] = new $class($config);
219
+                self::$instances[$instance]->setEventManager(EventManager::getInstance());
220 220
             } catch (phpFastCacheDriverCheckException $e) {
221
-                if ($config[ 'fallback' ]) {
221
+                if ($config['fallback']) {
222 222
                     try {
223
-                        $fallback = self::standardizeDriverName($config[ 'fallback' ]);
223
+                        $fallback = self::standardizeDriverName($config['fallback']);
224 224
                         if ($fallback !== $driver) {
225 225
                             $class = self::getNamespacePath() . $fallback . '\Driver';
226
-                            self::$instances[ $instance ] = new $class($config);
227
-                            self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
226
+                            self::$instances[$instance] = new $class($config);
227
+                            self::$instances[$instance]->setEventManager(EventManager::getInstance());
228 228
                             trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver,
229 229
                               $fallback), E_USER_WARNING);
230 230
                         } else {
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
238 238
                 }
239 239
             }
240
-        } else if ($badPracticeOmeter[ $driver ] >= 5) {
240
+        } else if ($badPracticeOmeter[$driver] >= 5) {
241 241
             trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
242 242
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
243 243
         }
244 244
 
245
-        $badPracticeOmeter[ $driver ]++;
245
+        $badPracticeOmeter[$driver]++;
246 246
 
247
-        return self::$instances[ $instance ];
247
+        return self::$instances[$instance];
248 248
     }
249 249
 
250 250
     /**
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      */
306 306
     public static function __callStatic($name, $arguments)
307 307
     {
308
-        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []);
308
+        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []);
309 309
 
310 310
         return self::getInstance($name, $options);
311 311
     }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
         if (is_array($name)) {
348 348
             self::$config = array_merge(self::$config, $name);
349 349
         } else if (is_string($name)) {
350
-            self::$config[ $name ] = $value;
350
+            self::$config[$name] = $value;
351 351
         } else {
352 352
             throw new phpFastCacheInvalidArgumentException('Invalid variable type: $name');
353 353
         }
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/Predis/Driver.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
         $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : [];
129 129
 
130 130
         $this->instance = new PredisClient(array_merge([
131
-          'host' => '127.0.0.1',
132
-          'port' => 6379,
133
-          'password' => null,
134
-          'database' => null,
131
+            'host' => '127.0.0.1',
132
+            'port' => 6379,
133
+            'password' => null,
134
+            'database' => null,
135 135
         ], $config));
136 136
 
137 137
         try {
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
         $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date');
175 175
 
176 176
         return (new DriverStatistic())
177
-          ->setData(implode(', ', array_keys($this->itemInstances)))
178
-          ->setRawData($info)
179
-          ->setSize($size)
180
-          ->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.",
177
+            ->setData(implode(', ', array_keys($this->itemInstances)))
178
+            ->setRawData($info)
179
+            ->setSize($size)
180
+            ->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.",
181 181
             $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.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     protected function driverConnect()
127 127
     {
128
-        $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : [];
128
+        $config = isset($this->config['predis']) ? $this->config['predis'] : [];
129 129
 
130 130
         $this->instance = new PredisClient(array_merge([
131 131
           'host' => '127.0.0.1',
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
     public function getStats()
170 170
     {
171 171
         $info = $this->instance->info();
172
-        $size = (isset($info[ 'Memory' ][ 'used_memory' ]) ? $info[ 'Memory' ][ 'used_memory' ] : 0);
173
-        $version = (isset($info[ 'Server' ][ 'redis_version' ]) ? $info[ 'Server' ][ 'redis_version' ] : 0);
174
-        $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date');
172
+        $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0);
173
+        $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0);
174
+        $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date');
175 175
 
176 176
         return (new DriverStatistic())
177 177
           ->setData(implode(', ', array_keys($this->itemInstances)))
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/Memcache/Driver.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
         $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []);
134 134
         if (count($servers) < 1) {
135 135
             $servers = [
136
-              [
136
+                [
137 137
                 'host' => '127.0.0.1',
138 138
                 'port' => 11211,
139 139
                 'sasl_user' => false,
140 140
                 'sasl_password' => false,
141
-              ],
141
+                ],
142 142
             ];
143 143
         }
144 144
 
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
         $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
176 176
 
177 177
         return (new DriverStatistic())
178
-          ->setData(implode(', ', array_keys($this->itemInstances)))
179
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
180
-          ->setRawData($stats)
181
-          ->setSize($stats[ 'bytes' ]);
178
+            ->setData(implode(', ', array_keys($this->itemInstances)))
179
+            ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
180
+            ->setRawData($stats)
181
+            ->setSize($stats[ 'bytes' ]);
182 182
     }
183 183
 }
184 184
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         } else {
54 54
             $this->driverConnect();
55 55
 
56
-            if (array_key_exists('compress_data', $config) && $config[ 'compress_data' ] === true) {
56
+            if (array_key_exists('compress_data', $config) && $config['compress_data'] === true) {
57 57
                 $this->memcacheFlags = MEMCACHE_COMPRESSED;
58 58
             }
59 59
         }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     protected function driverConnect()
131 131
     {
132 132
         $this->instance = new MemcacheSoftware();
133
-        $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []);
133
+        $servers = (!empty($this->config['servers']) && is_array($this->config['servers']) ? $this->config['servers'] : []);
134 134
         if (count($servers) < 1) {
135 135
             $servers = [
136 136
               [
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 
145 145
         foreach ($servers as $server) {
146 146
             try {
147
-                if (!$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) {
147
+                if (!$this->instance->addServer($server['host'], $server['port'])) {
148 148
                     $this->fallback = true;
149 149
                 }
150
-                if (!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password' ])) {
151
-                    $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password' ]);
150
+                if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) {
151
+                    $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']);
152 152
                 }
153 153
             } catch (\Exception $e) {
154 154
                 $this->fallback = true;
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
      */
168 168
     public function getStats()
169 169
     {
170
-        $stats = (array)$this->instance->getstats();
171
-        $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
172
-        $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion');
173
-        $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
170
+        $stats = (array) $this->instance->getstats();
171
+        $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0);
172
+        $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion');
173
+        $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0);
174 174
 
175
-        $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
175
+        $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']);
176 176
 
177 177
         return (new DriverStatistic())
178 178
           ->setData(implode(', ', array_keys($this->itemInstances)))
179
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
179
+          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822)))
180 180
           ->setRawData($stats)
181
-          ->setSize($stats[ 'bytes' ]);
181
+          ->setSize($stats['bytes']);
182 182
     }
183 183
 }
184 184
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Ssdb/Driver.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
     protected function driverConnect()
126 126
     {
127 127
         try {
128
-            $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [
128
+            $server = isset($this->config['ssdb']) ? $this->config['ssdb'] : [
129 129
               'host' => "127.0.0.1",
130 130
               'port' => 8888,
131 131
               'password' => '',
132 132
               'timeout' => 2000,
133 133
             ];
134 134
 
135
-            $host = $server[ 'host' ];
136
-            $port = isset($server[ 'port' ]) ? (int)$server[ 'port' ] : 8888;
137
-            $password = isset($server[ 'password' ]) ? $server[ 'password' ] : '';
138
-            $timeout = !empty($server[ 'timeout' ]) ? (int)$server[ 'timeout' ] : 2000;
135
+            $host = $server['host'];
136
+            $port = isset($server['port']) ? (int) $server['port'] : 8888;
137
+            $password = isset($server['password']) ? $server['password'] : '';
138
+            $timeout = !empty($server['timeout']) ? (int) $server['timeout'] : 2000;
139 139
             $this->instance = new SimpleSSDB($host, $port, $timeout);
140 140
             if (!empty($password)) {
141 141
                 $this->instance->auth($password);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
          * Data returned by Ssdb are very poorly formatted
170 170
          * using hardcoded offset of pair key-value :-(
171 171
          */
172
-        $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ]))
172
+        $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6]))
173 173
           ->setRawData($info)
174 174
           ->setData(implode(', ', array_keys($this->itemInstances)))
175 175
           ->setSize($this->instance->dbsize());
Please login to merge, or discard this patch.