Completed
Push — develop ( 6abdf9...2e09d4 )
by
unknown
03:02 queued 12s
created
src/Zanzara/ZanzaraCache.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -226,14 +226,14 @@  discard block
 block discarded – undo
226 226
      */
227 227
     public function deleteCacheItem(string $cacheKey, $key)
228 228
     {
229
-        return $this->cache->get($cacheKey)->then(function ($arrayData) use ($cacheKey, $key) {
229
+        return $this->cache->get($cacheKey)->then(function($arrayData) use ($cacheKey, $key) {
230 230
             if (!$arrayData) {
231 231
                 return true; //there isn't anything so it's deleted
232 232
             } else {
233 233
                 unset($arrayData[$key]);
234 234
             }
235 235
 
236
-            return $this->cache->set($cacheKey, $arrayData)->then(function ($result) {
236
+            return $this->cache->set($cacheKey, $arrayData)->then(function($result) {
237 237
                 if ($result !== true) {
238 238
                     $this->logger->errorWriteCache($result);
239 239
                 }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      */
250 250
     public function deleteCache(array $keys)
251 251
     {
252
-        return $this->cache->deleteMultiple($keys)->then(function ($result) {
252
+        return $this->cache->deleteMultiple($keys)->then(function($result) {
253 253
             if ($result !== true) {
254 254
                 $this->logger->errorClearCache($result);
255 255
             }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      */
266 266
     public function getCacheItem(string $cacheKey, $key)
267 267
     {
268
-        return $this->cache->get($cacheKey)->then(function ($arrayData) use ($key) {
268
+        return $this->cache->get($cacheKey)->then(function($arrayData) use ($key) {
269 269
             if ($arrayData && array_key_exists($key, $arrayData)) {
270 270
                 return $arrayData[$key];
271 271
             } else {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     public function doSet(string $cacheKey, string $key, $data, $ttl = null)
300 300
     {
301 301
         $ttl = $ttl ?? $this->config->getCacheTtl();
302
-        return $this->cache->get($cacheKey)->then(function ($arrayData) use ($ttl, $key, $data, $cacheKey) {
302
+        return $this->cache->get($cacheKey)->then(function($arrayData) use ($ttl, $key, $data, $cacheKey) {
303 303
             if (!$arrayData) {
304 304
                 $arrayData = array();
305 305
                 $arrayData[$key] = $data;
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                 $arrayData[$key] = $data;
308 308
             }
309 309
 
310
-            return $this->cache->set($cacheKey, $arrayData, $ttl)->then(function ($result) {
310
+            return $this->cache->set($cacheKey, $arrayData, $ttl)->then(function($result) {
311 311
                 if ($result !== true) {
312 312
                     $this->logger->errorWriteCache($result);
313 313
                 }
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
     public function appendCacheData(string $cacheKey, string $key, $data, $ttl = null)
329 329
     {
330 330
         $ttl = $ttl ?? $this->config->getCacheTtl();
331
-        return $this->cache->get($cacheKey)->then(function ($arrayData) use ($ttl, $key, $data, $cacheKey) {
331
+        return $this->cache->get($cacheKey)->then(function($arrayData) use ($ttl, $key, $data, $cacheKey) {
332 332
             $arrayData[$key][] = $data;
333 333
 
334
-            return $this->cache->set($cacheKey, $arrayData, $ttl)->then(function ($result) {
334
+            return $this->cache->set($cacheKey, $arrayData, $ttl)->then(function($result) {
335 335
                 if ($result !== true) {
336 336
                     $this->logger->errorWriteCache($result);
337 337
                 }
@@ -349,14 +349,14 @@  discard block
 block discarded – undo
349 349
      */
350 350
     public function callHandlerByChatId(int $chatId, $update, $container)
351 351
     {
352
-        return $this->cache->get($this->getConversationKey($chatId))->then(function ($conversation) use ($update, $chatId, $container) {
352
+        return $this->cache->get($this->getConversationKey($chatId))->then(function($conversation) use ($update, $chatId, $container) {
353 353
             if (!empty($conversation["state"])) {
354 354
                 $handler = $conversation["state"];
355 355
                 $handler(new Context($update, $container));
356 356
             }
357
-        }, function ($err) use ($container, $update) {
357
+        }, function($err) use ($container, $update) {
358 358
             $this->logger->errorUpdate($update, $err);
359
-        })->otherwise(function ($err) use ($update, $chatId) {
359
+        })->otherwise(function($err) use ($update, $chatId) {
360 360
             $this->logger->errorUpdate($err, $update);
361 361
             $this->deleteConversationCache($chatId);
362 362
         });
Please login to merge, or discard this patch.