Completed
Pull Request — final (#498)
by Georges
02:35
created
src/autoload.php 1 patch
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.
src/phpFastCache/Drivers/Sqlite/Driver.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
             $stm = $this->indexing->prepare("SELECT MAX(`db`) as `db` FROM `balancing`");
163 163
             $stm->execute();
164 164
             $row = $stm->fetch(PDO::FETCH_ASSOC);
165
-            if (!isset($row[ 'db' ])) {
165
+            if (!isset($row['db'])) {
166 166
                 $db = 1;
167
-            } elseif ($row[ 'db' ] <= 1) {
167
+            } elseif ($row['db'] <= 1) {
168 168
                 $db = 1;
169 169
             } else {
170
-                $db = $row[ 'db' ];
170
+                $db = $row['db'];
171 171
             }
172 172
 
173 173
             // check file size
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
           ':keyword' => $keyword,
190 190
         ]);
191 191
         $row = $stm->fetch(PDO::FETCH_ASSOC);
192
-        if (isset($row[ 'db' ]) && $row[ 'db' ] != '') {
193
-            $db = $row[ 'db' ];
192
+        if (isset($row['db']) && $row['db'] != '') {
193
+            $db = $row['db'];
194 194
         } else {
195 195
             /*
196 196
              * Insert new to Indexing
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         /**
222 222
          * init instant
223 223
          */
224
-        if (!isset($this->instance[ $instant ])) {
224
+        if (!isset($this->instance[$instant])) {
225 225
             // check DB Files ready or not
226 226
             $createTable = false;
227 227
             if (!file_exists($this->SqliteDir . '/db' . $instant) || $reset == true) {
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
                 $this->initDB($PDO);
235 235
             }
236 236
 
237
-            $this->instance[ $instant ] = $PDO;
237
+            $this->instance[$instant] = $PDO;
238 238
             unset($PDO);
239 239
 
240 240
         }
241 241
 
242
-        return $this->instance[ $instant ];
242
+        return $this->instance[$instant];
243 243
     }
244 244
 
245 245
     /**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
          * Check for Cross-Driver type confusion
254 254
          */
255 255
         if ($item instanceof Item) {
256
-            $skipExisting = isset($this->config[ 'skipExisting' ]) ? $this->config[ 'skipExisting' ] : false;
256
+            $skipExisting = isset($this->config['skipExisting']) ? $this->config['skipExisting'] : false;
257 257
             $toWrite = true;
258 258
 
259 259
             // check in cache first
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
             }
330 330
         }
331 331
 
332
-        if (isset($row[ 'object' ])) {
333
-            return $this->decode($row[ 'object' ]);
332
+        if (isset($row['object'])) {
333
+            return $this->decode($row['object']);
334 334
         }
335 335
 
336 336
         return null;
Please login to merge, or discard this patch.
src/phpFastCache/Helper/Psr16Adapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
     public function getMultiple($keys, $default = null)
111 111
     {
112 112
         try {
113
-            return array_map(function (ExtendedCacheItemInterface $item) {
113
+            return array_map(function(ExtendedCacheItemInterface $item) {
114 114
                 return $item->get();
115 115
             }, $this->internalCacheInstance->getItems($keys));
116 116
         } catch (phpFastCacheInvalidArgumentException $e) {
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Wincache/Driver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,11 +130,11 @@
 block discarded – undo
130 130
     {
131 131
         $memInfo = wincache_ucache_meminfo();
132 132
         $info = wincache_ucache_info();
133
-        $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]);
133
+        $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']);
134 134
 
135 135
         return (new DriverStatistic())
136 136
           ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
137
-          ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
137
+          ->setSize($memInfo['memory_free'] - $memInfo['memory_total'])
138 138
           ->setData(implode(', ', array_keys($this->itemInstances)))
139 139
           ->setRawData($memInfo);
140 140
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Xcache/Driver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
             $info = xcache_info(XC_TYPE_VAR, 0);
138 138
 
139 139
             return (new DriverStatistic())
140
-              ->setSize(abs($info[ 'size' ] - $info[ 'avail' ]))
140
+              ->setSize(abs($info['size'] - $info['avail']))
141 141
               ->setData(implode(', ', array_keys($this->itemInstances)))
142 142
               ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES)))
143 143
               ->setRawData($info);
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Apcu/Driver.php 1 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 1 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/Cassandra/Driver.php 1 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 1 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.