Skip to content

Commit 8ddd12a

Browse files
authored
Merge pull request #15 from koffinate/analysis-nK6Vrv
Apply fixes from StyleCI
2 parents 64a7563 + 3312bfd commit 8ddd12a

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

src/Base/BaseServiceProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Illuminate\Cache\Events as CacheEvents;
66
use Illuminate\Support\Facades\Event;
77
use Illuminate\Support\ServiceProvider;
8-
use Kfn\Base\Console;
98
use Kfn\Base\Exceptions\KfnException;
109
use Kfn\Base\Listeners\Cache as CacheListeners;
1110
use Symfony\Component\VarDumper\VarDumper;

src/Base/Console/CacheInvalidate.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class CacheInvalidate extends Command implements Isolatable
1616
* @var string
1717
*/
1818
protected $signature = 'cache:invalidate '.
19-
'{stores? : Which stores to invalidate}';
19+
'{stores? : Which stores to invalidate}';
2020

2121
/**
2222
* The console command description.
@@ -45,21 +45,21 @@ class CacheInvalidate extends Command implements Isolatable
4545
*/
4646
public function handle(): void
4747
{
48-
$stores = array_filter(explode(',', $this->argument('stores')), fn ($it) => !empty($it));
48+
$stores = array_filter(explode(',', $this->argument('stores')), fn ($it) => ! empty($it));
4949
$skipKeys = config('koffinate.base.cache.skip_invalidate_keys');
5050

5151
$cached = Cached::query()
5252
->select('id', 'key', 'store', 'expires_at')
5353
->where('expires_at', '<', now()->toAtomString());
5454

55-
if (!empty($skipKeys)) {
55+
if (! empty($skipKeys)) {
5656
is_array($skipKeys)
5757
? $cached->whereNotIn('key', $skipKeys)
5858
: $cached->where('key', '!=', $skipKeys);
5959
}
6060

6161
$fromStore = '';
62-
if (!empty($stores)) {
62+
if (! empty($stores)) {
6363
$fromStore = ' from store(s) '.implode(', ', $stores);
6464

6565
if (count($stores) === 1) {
@@ -72,18 +72,19 @@ public function handle(): void
7272
$this->components->alert('Invalidating caches'.$fromStore);
7373
$this->newLine();
7474

75-
if (!cacheIsHandling()) {
75+
if (! cacheIsHandling()) {
7676
$this->newLine();
7777
$this->components->warn('THIS FEATURE WAS DISABLED');
7878
$this->components->info('you can enable this feature via config "koffinate.base.cache.handling" or set KFN_CACHE_HANDLING to true on env');
79+
7980
return;
8081
}
8182

8283
Cached::$catchEvents = false;
8384

8485
$cached->chunkById(100, function ($caches) {
8586
$ids = [];
86-
++self::$chunkIncr;
87+
self::$chunkIncr++;
8788

8889
$this->components->task('invalidating cache #'.static::$chunkIncr, function () use ($caches, &$ids) {
8990
foreach ($caches as $cache) {
@@ -94,7 +95,7 @@ public function handle(): void
9495
} elseif ($cacheService->forget($cache->key)) {
9596
$ids[] = $cache->id;
9697
} else {
97-
++static::$totalFailed;
98+
static::$totalFailed++;
9899

99100
if ($this->output->isVerbose()) {
100101
self::$tempFailKeys[] = $cache->key;
@@ -106,12 +107,11 @@ public function handle(): void
106107
}
107108
}
108109

109-
if (!empty($ids)) {
110+
if (! empty($ids)) {
110111
try {
111112
if (Cached::query()->whereIn('id', $ids)->delete()) {
112113
self::$totalInvalidated += count($ids);
113114
}
114-
115115
} catch (\Throwable $tr) {
116116
$context = [
117117
'message' => $tr->getMessage(),
@@ -142,7 +142,7 @@ public function handle(): void
142142
self::$failKeys[] = self::$tempFailKeys;
143143
self::$tempFailKeys = [];
144144
}
145-
if (!empty(self::$failKeys)) {
145+
if (! empty(self::$failKeys)) {
146146
table(['failed key', 'failed key', 'failed key'], self::$failKeys);
147147
}
148148
}

src/Base/Listeners/Cache/FlushedListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public function handle(CacheFlushed $event): void
2929
}
3030

3131
$cached->delete();
32-
3332
} catch (\Throwable $tr) {
3433
$context = [
3534
'message' => $tr->getMessage(),

src/Base/Listeners/Cache/ForgottenListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public function handle(KeyForgotten $event): void
2525
->where('key', $event->key)
2626
->where('store', $event->storeName)
2727
->delete();
28-
2928
} catch (\Throwable $tr) {
3029
$context = [
3130
'message' => $tr->getMessage(),

src/Base/Listeners/Cache/WrittenListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function handle(KeyWritten $event): void
3636
->where('key', $data->get('key'))
3737
->where('store', $data->get('store'));
3838

39-
if (!empty($tags)) {
39+
if (! empty($tags)) {
4040
$cached->whereJsonContains('tags', $tags)
4141
->whereJsonLength('tags', count($tags));
4242
}

0 commit comments

Comments
 (0)