Completed
Branch v5.1 (393a37)
by Georges
03:26
created
src/phpFastCache/Drivers/Predis/Driver.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function driverConnect()
128 128
     {
129
-        $server = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : [
129
+        $server = isset($this->config['redis']) ? $this->config['redis'] : [
130 130
           'host' => '127.0.0.1',
131 131
           'port' => '6379',
132 132
           'password' => '',
@@ -134,32 +134,32 @@  discard block
 block discarded – undo
134 134
         ];
135 135
 
136 136
         $config = [
137
-          'host' => $server[ 'host' ],
137
+          'host' => $server['host'],
138 138
         ];
139 139
 
140
-        $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '';
140
+        $port = isset($server['port']) ? $server['port'] : '';
141 141
         if ($port != '') {
142
-            $config[ 'port' ] = $port;
142
+            $config['port'] = $port;
143 143
         }
144 144
 
145
-        $password = isset($server[ 'password' ]) ? $server[ 'password' ] : '';
145
+        $password = isset($server['password']) ? $server['password'] : '';
146 146
         if ($password != '') {
147
-            $config[ 'password' ] = $password;
147
+            $config['password'] = $password;
148 148
         }
149 149
 
150
-        $database = isset($server[ 'database' ]) ? $server[ 'database' ] : '';
150
+        $database = isset($server['database']) ? $server['database'] : '';
151 151
         if ($database != '') {
152
-            $config[ 'database' ] = $database;
152
+            $config['database'] = $database;
153 153
         }
154 154
 
155
-        $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : '';
155
+        $timeout = isset($server['timeout']) ? $server['timeout'] : '';
156 156
         if ($timeout != '') {
157
-            $config[ 'timeout' ] = $timeout;
157
+            $config['timeout'] = $timeout;
158 158
         }
159 159
 
160
-        $read_write_timeout = isset($server[ 'read_write_timeout' ]) ? $server[ 'read_write_timeout' ] : '';
160
+        $read_write_timeout = isset($server['read_write_timeout']) ? $server['read_write_timeout'] : '';
161 161
         if ($read_write_timeout != '') {
162
-            $config[ 'read_write_timeout' ] = $read_write_timeout;
162
+            $config['read_write_timeout'] = $read_write_timeout;
163 163
         }
164 164
 
165 165
         $this->instance = new PredisClient($config);
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Cookie/Driver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             $keyword = self::PREFIX . $item->getKey();
80 80
             $v = json_encode($this->driverPreWrap($item));
81 81
 
82
-            if (isset($this->config[ 'limited_memory_each_object' ]) && strlen($v) > $this->config[ 'limited_memory_each_object' ]) {
82
+            if (isset($this->config['limited_memory_each_object']) && strlen($v) > $this->config['limited_memory_each_object']) {
83 83
                 return false;
84 84
             }
85 85
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         // return null if no caching
101 101
         // return value if in caching
102 102
         $keyword = self::PREFIX . $key;
103
-        $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ], true)) : false;
103
+        $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword], true)) : false;
104 104
 
105 105
         if ($x == false) {
106 106
             return null;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $this->driverConnect();
123 123
         $keyword = self::PREFIX . $key;
124
-        $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ])->t) : false;
124
+        $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword])->t) : false;
125 125
 
126 126
         return $x ? $x - time() : $x;
127 127
     }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         if ($item instanceof Item) {
140 140
             $this->driverConnect();
141 141
             $keyword = self::PREFIX . $item->getKey();
142
-            $_COOKIE[ $keyword ] = null;
142
+            $_COOKIE[$keyword] = null;
143 143
 
144 144
             return @setcookie($keyword, null, -10);
145 145
         } else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         $this->driverConnect();
157 157
         foreach ($_COOKIE as $keyword => $value) {
158 158
             if (strpos($keyword, self::PREFIX) !== false) {
159
-                $_COOKIE[ $keyword ] = null;
159
+                $_COOKIE[$keyword] = null;
160 160
                 $result = @setcookie($keyword, null, -10);
161 161
                 if ($return !== false) {
162 162
                     $return = $result;
Please login to merge, or discard this patch.
src/phpFastCache/Util/Directory.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
             return unlink($source);
82 82
         }
83 83
 
84
-        $files = new RecursiveIteratorIterator
85
-        (
84
+        $files = new RecursiveIteratorIterator(
86 85
           new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
87 86
           RecursiveIteratorIterator::CHILD_FIRST
88 87
         );
@@ -95,7 +94,7 @@  discard block
 block discarded – undo
95 94
                 if (self::rrmdir($fileinfo->getRealPath()) === false) {
96 95
                     return false;
97 96
                 }
98
-            } else if(unlink($fileinfo->getRealPath()) === false) {
97
+            } else if (unlink($fileinfo->getRealPath()) === false) {
99 98
                 return false;
100 99
             }
101 100
         }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Sqlite/Driver.php 1 patch
Spacing   +12 added lines, -12 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,18 +329,18 @@  discard block
 block discarded – undo
329 329
             }
330 330
         }
331 331
 
332
-        if (isset($row[ 'id' ])) {
332
+        if (isset($row['id'])) {
333 333
             /**
334 334
              * @var $item ExtendedCacheItemInterface
335 335
              */
336
-            $item = $this->decode($row[ 'object' ]);
336
+            $item = $this->decode($row['object']);
337 337
             if ($item instanceof ExtendedCacheItemInterface && $item->isExpired()) {
338 338
                 $this->driverDelete($item);
339 339
 
340 340
                 return null;
341 341
             }
342 342
 
343
-            return $this->decode($row[ 'object' ]);
343
+            return $this->decode($row['object']);
344 344
         }
345 345
 
346 346
         return null;
Please login to merge, or discard this patch.
tests/Psr6InterfaceImplements.test.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
 if (!is_object($driverInstance)) {
24 24
     echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n";
25 25
     $status = 1;
26
-}else if(!($driverInstance instanceof CacheItemPoolInterface)){
26
+} else if (!($driverInstance instanceof CacheItemPoolInterface)) {
27 27
     echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n";
28 28
     $status = 1;
29
-}else{
29
+} else {
30 30
     echo '[PASS] CacheManager::getInstance() returned a valid CacheItemPoolInterface object: ' . get_class($driverInstance) . "\n";
31 31
 }
32 32
 
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Redis/Driver.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
         } else {
123 123
             $this->instance = $this->instance ?: new RedisClient();
124 124
 
125
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
126
-            $port = isset($this->config[ 'port' ]) ? (int) $this->config[ 'port' ] : '6379';
127
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
128
-            $database = isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : '';
129
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : '';
125
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
126
+            $port = isset($this->config['port']) ? (int) $this->config['port'] : '6379';
127
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
128
+            $database = isset($this->config['database']) ? $this->config['database'] : '';
129
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : '';
130 130
 
131 131
             if (!$this->instance->connect($host, (int) $port, (int) $timeout)) {
132 132
                 return false;
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
     {
157 157
         // used_memory
158 158
         $info = $this->instance->info();
159
-        $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]);
159
+        $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']);
160 160
 
161 161
         return (new driverStatistic())
162 162
           ->setData(implode(', ', array_keys($this->itemInstances)))
163 163
           ->setRawData($info)
164
-          ->setSize($info[ 'used_memory' ])
165
-          ->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)));
164
+          ->setSize($info['used_memory'])
165
+          ->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)));
166 166
     }
167 167
 }
168 168
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Memcached/Driver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     protected function driverConnect()
129 129
     {
130
-        $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
130
+        $servers = (!empty($this->config['memcache']) && is_array($this->config['memcache']) ? $this->config['memcache'] : []);
131 131
         if (count($servers) < 1) {
132 132
             $servers = [
133 133
               ['127.0.0.1', 11211],
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
         foreach ($servers as $server) {
138 138
             try {
139
-                if (!$this->instance->addServer($server[ 0 ], $server[ 1 ])) {
139
+                if (!$this->instance->addServer($server[0], $server[1])) {
140 140
                     $this->fallback = true;
141 141
                 }
142 142
             } catch (\Exception $e) {
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
     public function getStats()
158 158
     {
159 159
         $stats = (array) $this->instance->getStats();
160
-        $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
160
+        $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']);
161 161
 
162 162
         return (new driverStatistic())
163 163
           ->setData(implode(', ', array_keys($this->itemInstances)))
164
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
164
+          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822)))
165 165
           ->setRawData($stats)
166
-          ->setSize($stats[ 'bytes' ]);
166
+          ->setSize($stats['bytes']);
167 167
     }
168 168
 }
169 169
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Apcu/Driver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,12 +133,12 @@
 block discarded – undo
133 133
     public function getStats()
134 134
     {
135 135
         $stats = (array) apc_cache_info('user');
136
-        $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
136
+        $date = (new \DateTime())->setTimestamp($stats['start_time']);
137 137
 
138 138
         return (new driverStatistic())
139 139
           ->setData(implode(', ', array_keys($this->itemInstances)))
140
-          ->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), $stats[ 'num_entries' ]))
140
+          ->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), $stats['num_entries']))
141 141
           ->setRawData($stats)
142
-          ->setSize($stats[ 'mem_size' ]);
142
+          ->setSize($stats['mem_size']);
143 143
     }
144 144
 }
145 145
\ No newline at end of file
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
@@ -129,11 +129,11 @@
 block discarded – undo
129 129
     {
130 130
         $memInfo = wincache_ucache_meminfo();
131 131
         $info = wincache_ucache_info();
132
-        $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]);
132
+        $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']);
133 133
 
134 134
         return (new driverStatistic())
135 135
           ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
136
-          ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
136
+          ->setSize($memInfo['memory_free'] - $memInfo['memory_total'])
137 137
           ->setData(implode(', ', array_keys($this->itemInstances)))
138 138
           ->setRawData($memInfo);
139 139
     }
Please login to merge, or discard this patch.