@@ -40,15 +40,15 @@ |
||
40 | 40 | */ |
41 | 41 | public function register() |
42 | 42 | { |
43 | - $this->app->singleton('cache', function ($app) { |
|
43 | + $this->app->singleton('cache', function($app) { |
|
44 | 44 | return (new CacheManager($app))->driver(); |
45 | 45 | }); |
46 | 46 | |
47 | - $this->app->singleton('cache.store', function ($app) { |
|
47 | + $this->app->singleton('cache.store', function($app) { |
|
48 | 48 | return $app['cache']->driver(); |
49 | 49 | }); |
50 | 50 | |
51 | - $this->app->singleton('memcached.connector', function () { |
|
51 | + $this->app->singleton('memcached.connector', function() { |
|
52 | 52 | return new MemcachedConnector; |
53 | 53 | }); |
54 | 54 | } |
@@ -46,13 +46,13 @@ |
||
46 | 46 | */ |
47 | 47 | protected $keyName; |
48 | 48 | |
49 | - /** |
|
50 | - * Constructor. Create a new cache key instance. |
|
51 | - * |
|
52 | - * @param string $key |
|
53 | - * |
|
54 | - * @return string |
|
55 | - */ |
|
49 | + /** |
|
50 | + * Constructor. Create a new cache key instance. |
|
51 | + * |
|
52 | + * @param string $key |
|
53 | + * |
|
54 | + * @return string |
|
55 | + */ |
|
56 | 56 | public function __construct($key) |
57 | 57 | { |
58 | 58 | $this->keyName = $this->getFixKeyChars($key); |
@@ -310,11 +310,11 @@ |
||
310 | 310 | return $this->files; |
311 | 311 | } |
312 | 312 | |
313 | - /** |
|
314 | - * Get the cache key prefix. |
|
315 | - * |
|
316 | - * @return string |
|
317 | - */ |
|
313 | + /** |
|
314 | + * Get the cache key prefix. |
|
315 | + * |
|
316 | + * @return string |
|
317 | + */ |
|
318 | 318 | public function getPrefix() |
319 | 319 | { |
320 | 320 | return ''; |
@@ -105,8 +105,7 @@ discard block |
||
105 | 105 | try |
106 | 106 | { |
107 | 107 | $expires = substr($contents = $this->files->get($path, true), 0, 10); |
108 | - } |
|
109 | - catch (Exception $e) |
|
108 | + } catch (Exception $e) |
|
110 | 109 | { |
111 | 110 | return $this->emptyPayLoad(); |
112 | 111 | } |
@@ -123,8 +122,7 @@ discard block |
||
123 | 122 | $data = (new FileCacheRegister) |
124 | 123 | ->unserialize(substr($contents, 10)) |
125 | 124 | ->getData(); |
126 | - } |
|
127 | - catch (Exception $e) |
|
125 | + } catch (Exception $e) |
|
128 | 126 | { |
129 | 127 | return $this->emptyPayLoad(); |
130 | 128 | } |
@@ -148,13 +148,13 @@ |
||
148 | 148 | return $this->memcached->decrement($this->prefix.$key, $value = 1); |
149 | 149 | } |
150 | 150 | |
151 | - /** |
|
152 | - * Remove a specific item from the cache store. |
|
153 | - * |
|
154 | - * @param string $key |
|
155 | - * |
|
156 | - * @return bool |
|
157 | - */ |
|
151 | + /** |
|
152 | + * Remove a specific item from the cache store. |
|
153 | + * |
|
154 | + * @param string $key |
|
155 | + * |
|
156 | + * @return bool |
|
157 | + */ |
|
158 | 158 | public function delete($key) |
159 | 159 | { |
160 | 160 | return $this->memcached->delete($this->prefix.$key); |
@@ -51,7 +51,9 @@ |
||
51 | 51 | */ |
52 | 52 | public function get($key) |
53 | 53 | { |
54 | - if ( ! isset($this->storage[$key])) return; |
|
54 | + if ( ! isset($this->storage[$key])) { |
|
55 | + return; |
|
56 | + } |
|
55 | 57 | |
56 | 58 | $item = $this->storage[$key]; |
57 | 59 |
@@ -303,7 +303,7 @@ |
||
303 | 303 | */ |
304 | 304 | public function getDefaultDriver() |
305 | 305 | { |
306 | - return $this->app['config']['cache.default']; |
|
306 | + return $this->app['config']['cache.default']; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -137,16 +137,14 @@ |
||
137 | 137 | if (isset($this->customDriver[$config['driver']])) |
138 | 138 | { |
139 | 139 | return $this->callCustomDriver($config); |
140 | - } |
|
141 | - else |
|
140 | + } else |
|
142 | 141 | { |
143 | 142 | $driver = 'create'.ucfirst($config['driver']).'Driver'; |
144 | 143 | |
145 | 144 | if (method_exists($this, $driver)) |
146 | 145 | { |
147 | 146 | return $this->{$driver}($config); |
148 | - } |
|
149 | - else |
|
147 | + } else |
|
150 | 148 | { |
151 | 149 | throw new CacheException(__('cache.driverNotSupported', ['config' => $config])); |
152 | 150 | } |
@@ -105,7 +105,7 @@ |
||
105 | 105 | */ |
106 | 106 | public function pull($key, $default = null) |
107 | 107 | { |
108 | - return take($this->get($key, $default), function () use ($key) { |
|
108 | + return take($this->get($key, $default), function() use ($key) { |
|
109 | 109 | $this->delete($key); |
110 | 110 | }); |
111 | 111 | } |
@@ -66,12 +66,10 @@ |
||
66 | 66 | if ($time instanceof static) |
67 | 67 | { |
68 | 68 | $time = $time->toDateTime()->setTimezone(new DateTimeZone('UTC')); |
69 | - } |
|
70 | - elseif ($time instanceof DateTime) |
|
69 | + } elseif ($time instanceof DateTime) |
|
71 | 70 | { |
72 | 71 | $time = $time->setTimezone(new DateTimeZone('UTC')); |
73 | - } |
|
74 | - elseif (is_string($time)) |
|
72 | + } elseif (is_string($time)) |
|
75 | 73 | { |
76 | 74 | $timezone = $timezone ?: $this->timezone; |
77 | 75 | $timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone('UTC'); |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | { |
46 | 46 | $testTime = $this->getConvertedUTC($time, $timezone); |
47 | 47 | $ourTime = $this->toDateTime() |
48 | - ->setTimezone(new DateTimeZone('UTC')) |
|
49 | - ->format('Y-m-d H:i:s'); |
|
48 | + ->setTimezone(new DateTimeZone('UTC')) |
|
49 | + ->format('Y-m-d H:i:s'); |
|
50 | 50 | |
51 | 51 | return $testTime->format('Y-m-d H:i:s') === $ourTime; |
52 | 52 | } |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | return $testTime < $ourTime; |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
72 | - * Determines if the current instance's time is after test time, |
|
73 | - * after converting to UTC. |
|
74 | - * |
|
75 | - * @param \DateTime|string $time |
|
76 | - * @param \DatetimeZone|string|null $timezone |
|
77 | - * |
|
78 | - * @return bool |
|
79 | - */ |
|
71 | + /** |
|
72 | + * Determines if the current instance's time is after test time, |
|
73 | + * after converting to UTC. |
|
74 | + * |
|
75 | + * @param \DateTime|string $time |
|
76 | + * @param \DatetimeZone|string|null $timezone |
|
77 | + * |
|
78 | + * @return bool |
|
79 | + */ |
|
80 | 80 | public function isAfter($time, string $timezone = null) |
81 | 81 | { |
82 | 82 | $testTime = $this->getConvertedUTC($time, $timezone)->getTimestamp(); |
@@ -100,8 +100,7 @@ |
||
100 | 100 | if ($time instanceof DateTime) |
101 | 101 | { |
102 | 102 | $testTime = $time->format('Y-m-d H:i:s'); |
103 | - } |
|
104 | - elseif (is_string($time)) |
|
103 | + } elseif (is_string($time)) |
|
105 | 104 | { |
106 | 105 | $timezone = $timezone ?: $this->timezone; |
107 | 106 | $timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone); |