Completed
Push — 6.0 ( d6c8d7...cb8a0b )
by liu
05:58
created
src/think/cache/driver/Memcached.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -188,8 +188,7 @@
 block discarded – undo
188 188
         $key = $this->getCacheKey($name);
189 189
 
190 190
         return false === $ttl ?
191
-        $this->handler->delete($key) :
192
-        $this->handler->delete($key, $ttl);
191
+        $this->handler->delete($key) : $this->handler->delete($key, $ttl);
193 192
     }
194 193
 
195 194
     /**
Please login to merge, or discard this patch.
src/think/cache/CacheItem.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\cache;
14 14
 
Please login to merge, or discard this patch.
src/think/cache/driver/Memcache.php 1 patch
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
         foreach ($hosts as $i => $host) {
57 57
             $port = $ports[$i] ?? $ports[0];
58 58
             $this->options['timeout'] > 0 ?
59
-            $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1, $this->options['timeout']) :
60
-            $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1);
59
+            $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1, $this->options['timeout']) : $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1);
61 60
         }
62 61
     }
63 62
 
@@ -174,8 +173,7 @@  discard block
 block discarded – undo
174 173
         $key = $this->getCacheKey($name);
175 174
 
176 175
         return false === $ttl ?
177
-        $this->handler->delete($key) :
178
-        $this->handler->delete($key, $ttl);
176
+        $this->handler->delete($key) : $this->handler->delete($key, $ttl);
179 177
     }
180 178
 
181 179
     /**
Please login to merge, or discard this patch.
src/think/cache/driver/Redis.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
             $this->handler = new \Redis;
56 56
 
57 57
             if ($this->options['persistent']) {
58
-                $this->handler->pconnect($this->options['host'], (int) $this->options['port'], $this->options['timeout'], 'persistent_id_' . $this->options['select']);
58
+                $this->handler->pconnect($this->options['host'], (int) $this->options['port'], $this->options['timeout'], 'persistent_id_'.$this->options['select']);
59 59
             } else {
60 60
                 $this->handler->connect($this->options['host'], (int) $this->options['port'], $this->options['timeout']);
61 61
             }
Please login to merge, or discard this patch.
src/think/cache/TagSet.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\cache;
14 14
 
Please login to merge, or discard this patch.
src/think/Cache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
         if ($force || !isset($this->instance[$name])) {
81 81
             if (!isset($this->config['stores'][$name])) {
82
-                throw new InvalidArgumentException('Undefined cache config:' . $name);
82
+                throw new InvalidArgumentException('Undefined cache config:'.$name);
83 83
             }
84 84
 
85 85
             $options = $this->config['stores'][$name];
Please login to merge, or discard this patch.
src/think/exception/InvalidArgumentException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 namespace think\exception;
13 13
 
14 14
 use Psr\Cache\InvalidArgumentException as Psr6CacheInvalidArgumentInterface;
Please login to merge, or discard this patch.
src/think/cache/Driver.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\cache;
14 14
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function getCacheKey(string $name): string
84 84
     {
85
-        return $this->options['prefix'] . $name;
85
+        return $this->options['prefix'].$name;
86 86
     }
87 87
 
88 88
     /**
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 
144 144
         $time = time();
145 145
 
146
-        while ($time + 5 > time() && $this->has($name . '_lock')) {
146
+        while ($time + 5 > time() && $this->has($name.'_lock')) {
147 147
             // 存在锁定则等待
148 148
             usleep(200000);
149 149
         }
150 150
 
151 151
         try {
152 152
             // 锁定
153
-            $this->set($name . '_lock', true);
153
+            $this->set($name.'_lock', true);
154 154
 
155 155
             if ($value instanceof \Closure) {
156 156
                 // 获取缓存数据
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
             $this->set($name, $value, $expire);
162 162
 
163 163
             // 解锁
164
-            $this->delete($name . '_lock');
164
+            $this->delete($name.'_lock');
165 165
         } catch (\Exception | \throwable $e) {
166
-            $this->delete($name . '_lock');
166
+            $this->delete($name.'_lock');
167 167
             throw $e;
168 168
         }
169 169
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         $key  = implode('-', $name);
183 183
 
184 184
         if (!isset($this->tag[$key])) {
185
-            $name = array_map(function ($val) {
185
+            $name = array_map(function($val) {
186 186
                 return $this->getTagKey($val);
187 187
             }, $name);
188 188
             $this->tag[$key] = new TagSet($name, $this);
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      */
212 212
     public function getTagKey(string $tag): string
213 213
     {
214
-        return $this->options['tag_prefix'] . md5($tag);
214
+        return $this->options['tag_prefix'].md5($tag);
215 215
     }
216 216
 
217 217
     /**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      */
223 223
     protected function serialize($data): string
224 224
     {
225
-        $serialize = $this->options['serialize'][0] ?? function ($data) {
225
+        $serialize = $this->options['serialize'][0] ?? function($data) {
226 226
             SerializableClosure::enterContext();
227 227
             SerializableClosure::wrapClosures($data);
228 228
             $data = \serialize($data);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      */
242 242
     protected function unserialize(string $data)
243 243
     {
244
-        $unserialize = $this->options['serialize'][1] ?? function ($data) {
244
+        $unserialize = $this->options['serialize'][1] ?? function($data) {
245 245
             SerializableClosure::enterContext();
246 246
             $data = \unserialize($data);
247 247
             SerializableClosure::unwrapClosures($data);
Please login to merge, or discard this patch.
src/think/cache/driver/File.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\cache\driver;
14 14
 
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 
68 68
         if ($this->options['cache_subdir']) {
69 69
             // 使用子目录
70
-            $name = substr($name, 0, 2) . DIRECTORY_SEPARATOR . substr($name, 2);
70
+            $name = substr($name, 0, 2).DIRECTORY_SEPARATOR.substr($name, 2);
71 71
         }
72 72
 
73 73
         if ($this->options['prefix']) {
74
-            $name = $this->options['prefix'] . DIRECTORY_SEPARATOR . $name;
74
+            $name = $this->options['prefix'].DIRECTORY_SEPARATOR.$name;
75 75
         }
76 76
 
77
-        return $this->options['path'] . $name . '.php';
77
+        return $this->options['path'].$name.'.php';
78 78
     }
79 79
 
80 80
     /**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             $data = gzcompress($data, 3);
166 166
         }
167 167
 
168
-        $data   = "<?php\n//" . sprintf('%012d', $expire) . "\n exit();?>\n" . $data;
168
+        $data   = "<?php\n//".sprintf('%012d', $expire)."\n exit();?>\n".$data;
169 169
         $result = file_put_contents($filename, $data);
170 170
 
171 171
         if ($result) {
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
     {
243 243
         $this->writeTimes++;
244 244
 
245
-        $files = (array) glob($this->options['path'] . ($this->options['prefix'] ? $this->options['prefix'] . DIRECTORY_SEPARATOR : '') . '*');
245
+        $files = (array) glob($this->options['path'].($this->options['prefix'] ? $this->options['prefix'].DIRECTORY_SEPARATOR : '').'*');
246 246
 
247 247
         foreach ($files as $path) {
248 248
             if (is_dir($path)) {
249
-                $matches = glob($path . DIRECTORY_SEPARATOR . '*.php');
249
+                $matches = glob($path.DIRECTORY_SEPARATOR.'*.php');
250 250
                 if (is_array($matches)) {
251 251
                     array_map('unlink', $matches);
252 252
                 }
Please login to merge, or discard this patch.