Completed
Push — develop ( 32d851...a318ff )
by Michele
87:15 queued 85:13
created
src/Zanzara/ZanzaraCache.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -219,14 +219,14 @@  discard block
 block discarded – undo
219 219
      */
220 220
     public function deleteCacheItem(string $cacheKey, $key)
221 221
     {
222
-        return $this->cache->get($cacheKey)->then(function ($arrayData) use ($cacheKey, $key) {
222
+        return $this->cache->get($cacheKey)->then(function($arrayData) use ($cacheKey, $key) {
223 223
             if (!$arrayData) {
224 224
                 return true; //there isn't anything so it's deleted
225 225
             } else {
226 226
                 unset($arrayData[$key]);
227 227
             }
228 228
 
229
-            return $this->cache->set($cacheKey, $arrayData)->then(function ($result) {
229
+            return $this->cache->set($cacheKey, $arrayData)->then(function($result) {
230 230
                 if ($result !== true) {
231 231
                     $this->logger->errorWriteCache($result);
232 232
                 }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
      */
243 243
     public function deleteCache(array $keys)
244 244
     {
245
-        return $this->cache->deleteMultiple($keys)->then(function ($result) {
245
+        return $this->cache->deleteMultiple($keys)->then(function($result) {
246 246
             if ($result !== true) {
247 247
                 $this->logger->errorClearCache($result);
248 248
             }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function getCacheItem(string $cacheKey, $key)
260 260
     {
261
-        return $this->cache->get($cacheKey)->then(function ($arrayData) use ($key) {
261
+        return $this->cache->get($cacheKey)->then(function($arrayData) use ($key) {
262 262
             if ($arrayData && array_key_exists($key, $arrayData)) {
263 263
                 return $arrayData[$key];
264 264
             } else {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      */
291 291
     public function doSet(string $cacheKey, string $key, $data)
292 292
     {
293
-        return $this->cache->get($cacheKey)->then(function ($arrayData) use ($key, $data, $cacheKey) {
293
+        return $this->cache->get($cacheKey)->then(function($arrayData) use ($key, $data, $cacheKey) {
294 294
             if (!$arrayData) {
295 295
                 $arrayData = array();
296 296
                 $arrayData[$key] = $data;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
                 $arrayData[$key] = $data;
299 299
             }
300 300
 
301
-            return $this->cache->set($cacheKey, $arrayData)->then(function ($result) {
301
+            return $this->cache->set($cacheKey, $arrayData)->then(function($result) {
302 302
                 if ($result !== true) {
303 303
                     $this->logger->errorWriteCache($result);
304 304
                 }
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
      */
318 318
     public function appendCacheData(string $cacheKey, string $key, $data)
319 319
     {
320
-        return $this->cache->get($cacheKey)->then(function ($arrayData) use ($key, $data, $cacheKey) {
320
+        return $this->cache->get($cacheKey)->then(function($arrayData) use ($key, $data, $cacheKey) {
321 321
             $arrayData[$key][] = $data;
322 322
 
323
-            return $this->cache->set($cacheKey, $arrayData)->then(function ($result) {
323
+            return $this->cache->set($cacheKey, $arrayData)->then(function($result) {
324 324
                 if ($result !== true) {
325 325
                     $this->logger->errorWriteCache($result);
326 326
                 }
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
      */
339 339
     public function callHandlerByChatId(int $chatId, $update, $container)
340 340
     {
341
-        return $this->cache->get($this->getConversationKey($chatId))->then(function (array $conversation) use ($update, $chatId, $container) {
341
+        return $this->cache->get($this->getConversationKey($chatId))->then(function(array $conversation) use ($update, $chatId, $container) {
342 342
             if (!empty($conversation)) {
343 343
                 $handler = $conversation["state"];
344 344
                 $handler(new Context($update, $container));
345 345
             }
346
-        }, function ($err) use ($container, $update) {
346
+        }, function($err) use ($container, $update) {
347 347
             $this->logger->errorUpdate($update, $err);
348
-        })->otherwise(function ($err, $update, $chatId) {
348
+        })->otherwise(function($err, $update, $chatId) {
349 349
             $this->logger->errorUpdate($err, $update);
350 350
             $this->deleteConversationCache($chatId);
351 351
         });
Please login to merge, or discard this patch.