@@ -17,7 +17,7 @@ |
||
17 | 17 | * @param string $key |
18 | 18 | * @param mixed $value |
19 | 19 | * @param array $tags |
20 | - * @return void |
|
20 | + * @return string |
|
21 | 21 | */ |
22 | 22 | public function __construct($key, $value, array $tags = []) |
23 | 23 | { |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * @param mixed $value |
26 | 26 | * @param int $minutes |
27 | 27 | * @param array $tags |
28 | - * @return void |
|
28 | + * @return string |
|
29 | 29 | */ |
30 | 30 | public function __construct($key, $value, $minutes, $tags = []) |
31 | 31 | { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @param \Illuminate\Filesystem\Filesystem $files |
32 | 32 | * @param string $directory |
33 | - * @return void |
|
33 | + * @return Store |
|
34 | 34 | */ |
35 | 35 | public function __construct(Filesystem $files, $directory) |
36 | 36 | { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * Increment the value of an item in the cache. |
84 | 84 | * |
85 | 85 | * @param string $key |
86 | - * @param mixed $value |
|
86 | + * @param integer $value |
|
87 | 87 | * @return int |
88 | 88 | */ |
89 | 89 | public function increment($key, $value = 1) |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * Decrement the value of an item in the cache. |
100 | 100 | * |
101 | 101 | * @param string $key |
102 | - * @param mixed $value |
|
102 | + * @param integer $value |
|
103 | 103 | * @return int |
104 | 104 | */ |
105 | 105 | public function decrement($key, $value = 1) |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function ensureCacheDirectoryExists($path) |
76 | 76 | { |
77 | - if (! $this->files->exists(dirname($path))) { |
|
77 | + if (!$this->files->exists(dirname($path))) { |
|
78 | 78 | $this->files->makeDirectory(dirname($path), 0777, true, true); |
79 | 79 | } |
80 | 80 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | $raw = $this->getPayload($key); |
92 | 92 | |
93 | - return tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) { |
|
93 | + return tap(((int) $raw['data']) + $value, function($newValue) use ($key, $raw) { |
|
94 | 94 | $this->put($key, $newValue, $raw['time'] ?? 0); |
95 | 95 | }); |
96 | 96 | } |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function flush() |
143 | 143 | { |
144 | - if (! $this->files->isDirectory($this->directory)) { |
|
144 | + if (!$this->files->isDirectory($this->directory)) { |
|
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | |
148 | 148 | foreach ($this->files->directories($this->directory) as $directory) { |
149 | - if (! $this->files->deleteDirectory($directory)) { |
|
149 | + if (!$this->files->deleteDirectory($directory)) { |
|
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | { |
91 | 91 | $raw = $this->getPayload($key); |
92 | 92 | |
93 | - return tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) { |
|
93 | + return tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw){ |
|
94 | 94 | $this->put($key, $newValue, $raw['time'] ?? 0); |
95 | 95 | }); |
96 | 96 | } |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Cache; |
4 | 4 | |
5 | -use Illuminate\Support\InteractsWithTime; |
|
6 | 5 | use Illuminate\Contracts\Cache\LockTimeoutException; |
6 | +use Illuminate\Support\InteractsWithTime; |
|
7 | 7 | |
8 | 8 | abstract class Lock |
9 | 9 | { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $result = $this->acquire(); |
55 | 55 | |
56 | 56 | if ($result && is_callable($callback)) { |
57 | - return tap($callback(), function () { |
|
57 | + return tap($callback(), function(){ |
|
58 | 58 | $this->release(); |
59 | 59 | }); |
60 | 60 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $starting = $this->currentTime(); |
76 | 76 | |
77 | - while (! $this->acquire()) { |
|
77 | + while (!$this->acquire()) { |
|
78 | 78 | usleep(250 * 1000); |
79 | 79 | |
80 | 80 | if ($this->currentTime() - $seconds >= $starting) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | if (is_callable($callback)) { |
86 | - return tap($callback(), function () { |
|
86 | + return tap($callback(), function(){ |
|
87 | 87 | $this->release(); |
88 | 88 | }); |
89 | 89 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $result = $this->acquire(); |
55 | 55 | |
56 | 56 | if ($result && is_callable($callback)) { |
57 | - return tap($callback(), function () { |
|
57 | + return tap($callback(), function (){ |
|
58 | 58 | $this->release(); |
59 | 59 | }); |
60 | 60 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | if (is_callable($callback)) { |
86 | - return tap($callback(), function () { |
|
86 | + return tap($callback(), function (){ |
|
87 | 87 | $this->release(); |
88 | 88 | }); |
89 | 89 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param \Memcached $memcached |
40 | 40 | * @param string $prefix |
41 | - * @return void |
|
41 | + * @return Store |
|
42 | 42 | */ |
43 | 43 | public function __construct($memcached, $prefix = '') |
44 | 44 | { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @param string $key |
100 | 100 | * @param mixed $value |
101 | - * @param float|int $minutes |
|
101 | + * @param integer $minutes |
|
102 | 102 | * @return void |
103 | 103 | */ |
104 | 104 | public function put($key, $value, $minutes) |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * Increment the value of an item in the cache. |
142 | 142 | * |
143 | 143 | * @param string $key |
144 | - * @param mixed $value |
|
144 | + * @param integer $value |
|
145 | 145 | * @return int|bool |
146 | 146 | */ |
147 | 147 | public function increment($key, $value = 1) |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * Decrement the value of an item in the cache. |
154 | 154 | * |
155 | 155 | * @param string $key |
156 | - * @param mixed $value |
|
156 | + * @param integer $value |
|
157 | 157 | * @return int|bool |
158 | 158 | */ |
159 | 159 | public function decrement($key, $value = 1) |
@@ -2,11 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Cache; |
4 | 4 | |
5 | -use Memcached; |
|
6 | -use ReflectionMethod; |
|
5 | +use Illuminate\Contracts\Cache\LockProvider; |
|
7 | 6 | use Illuminate\Contracts\Cache\Store; |
8 | 7 | use Illuminate\Support\InteractsWithTime; |
9 | -use Illuminate\Contracts\Cache\LockProvider; |
|
8 | +use Memcached; |
|
9 | +use ReflectionMethod; |
|
10 | 10 | |
11 | 11 | class MemcachedStore extends TaggableStore implements LockProvider, Store |
12 | 12 | { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function many(array $keys) |
76 | 76 | { |
77 | - $prefixedKeys = array_map(function ($key) { |
|
77 | + $prefixedKeys = array_map(function($key){ |
|
78 | 78 | return $this->prefix.$key; |
79 | 79 | }, $keys); |
80 | 80 | |
@@ -245,6 +245,6 @@ discard block |
||
245 | 245 | */ |
246 | 246 | public function setPrefix($prefix) |
247 | 247 | { |
248 | - $this->prefix = ! empty($prefix) ? $prefix.':' : ''; |
|
248 | + $this->prefix = !empty($prefix) ? $prefix.':' : ''; |
|
249 | 249 | } |
250 | 250 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | */ |
75 | 75 | public function many(array $keys) |
76 | 76 | { |
77 | - $prefixedKeys = array_map(function ($key) { |
|
77 | + $prefixedKeys = array_map(function ($key){ |
|
78 | 78 | return $this->prefix.$key; |
79 | 79 | }, $keys); |
80 | 80 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * Increment the value of an item in the cache. |
44 | 44 | * |
45 | 45 | * @param string $key |
46 | - * @param mixed $value |
|
46 | + * @param integer $value |
|
47 | 47 | * @return int |
48 | 48 | */ |
49 | 49 | public function increment($key, $value = 1) |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * Decrement the value of an item in the cache. |
56 | 56 | * |
57 | 57 | * @param string $key |
58 | - * @param mixed $value |
|
58 | + * @param integer $value |
|
59 | 59 | * @return int |
60 | 60 | */ |
61 | 61 | public function decrement($key, $value = 1) |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * Increment the counter for a given key for a given decay time. |
52 | 52 | * |
53 | 53 | * @param string $key |
54 | - * @param float|int $decayMinutes |
|
54 | + * @param integer $decayMinutes |
|
55 | 55 | * @return int |
56 | 56 | */ |
57 | 57 | public function hit($key, $decayMinutes = 1) |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * Reset the number of attempts for the given key. |
87 | 87 | * |
88 | 88 | * @param string $key |
89 | - * @return mixed |
|
89 | + * @return boolean |
|
90 | 90 | */ |
91 | 91 | public function resetAttempts($key) |
92 | 92 | { |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Cache; |
4 | 4 | |
5 | -use Illuminate\Support\InteractsWithTime; |
|
6 | 5 | use Illuminate\Contracts\Cache\Repository as Cache; |
6 | +use Illuminate\Support\InteractsWithTime; |
|
7 | 7 | |
8 | 8 | class RateLimiter |
9 | 9 | { |
@@ -64,7 +64,7 @@ |
||
64 | 64 | |
65 | 65 | $hits = (int) $this->cache->increment($key); |
66 | 66 | |
67 | - if (! $added && $hits == 1) { |
|
67 | + if (!$added && $hits == 1) { |
|
68 | 68 | $this->cache->put($key, 1, $decayMinutes); |
69 | 69 | } |
70 | 70 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param \Illuminate\Contracts\Redis\Factory $redis |
35 | 35 | * @param string $prefix |
36 | 36 | * @param string $connection |
37 | - * @return void |
|
37 | + * @return Store |
|
38 | 38 | */ |
39 | 39 | public function __construct(Redis $redis, $prefix = '', $connection = 'default') |
40 | 40 | { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * Increment the value of an item in the cache. |
134 | 134 | * |
135 | 135 | * @param string $key |
136 | - * @param mixed $value |
|
136 | + * @param integer $value |
|
137 | 137 | * @return int |
138 | 138 | */ |
139 | 139 | public function increment($key, $value = 1) |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * Decrement the value of an item in the cache. |
146 | 146 | * |
147 | 147 | * @param string $key |
148 | - * @param mixed $value |
|
148 | + * @param integer $value |
|
149 | 149 | * @return int |
150 | 150 | */ |
151 | 151 | public function decrement($key, $value = 1) |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $value = $this->connection()->get($this->prefix.$key); |
55 | 55 | |
56 | - return ! is_null($value) ? $this->unserialize($value) : null; |
|
56 | + return !is_null($value) ? $this->unserialize($value) : null; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | { |
69 | 69 | $results = []; |
70 | 70 | |
71 | - $values = $this->connection()->mget(array_map(function ($key) { |
|
71 | + $values = $this->connection()->mget(array_map(function($key){ |
|
72 | 72 | return $this->prefix.$key; |
73 | 73 | }, $keys)); |
74 | 74 | |
75 | 75 | foreach ($values as $index => $value) { |
76 | - $results[$keys[$index]] = ! is_null($value) ? $this->unserialize($value) : null; |
|
76 | + $results[$keys[$index]] = !is_null($value) ? $this->unserialize($value) : null; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return $results; |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public function setPrefix($prefix) |
264 | 264 | { |
265 | - $this->prefix = ! empty($prefix) ? $prefix.':' : ''; |
|
265 | + $this->prefix = !empty($prefix) ? $prefix.':' : ''; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -68,7 +68,7 @@ |
||
68 | 68 | { |
69 | 69 | $results = []; |
70 | 70 | |
71 | - $values = $this->connection()->mget(array_map(function ($key) { |
|
71 | + $values = $this->connection()->mget(array_map(function ($key){ |
|
72 | 72 | return $this->prefix.$key; |
73 | 73 | }, $keys)); |
74 | 74 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * Increment the value of an item in the cache. |
37 | 37 | * |
38 | 38 | * @param string $key |
39 | - * @param mixed $value |
|
39 | + * @param integer $value |
|
40 | 40 | * @return void |
41 | 41 | */ |
42 | 42 | public function increment($key, $value = 1) |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * Decrement the value of an item in the cache. |
51 | 51 | * |
52 | 52 | * @param string $key |
53 | - * @param mixed $value |
|
53 | + * @param integer $value |
|
54 | 54 | * @return void |
55 | 55 | */ |
56 | 56 | public function decrement($key, $value = 1) |