RefreshCache   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 15
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 5 1
1
<?php
2
3
namespace Mostafaznv\LaraCache\Jobs;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Foundation\Bus\Dispatchable;
8
use Illuminate\Queue\InteractsWithQueue;
9
use Illuminate\Queue\SerializesModels;
10
use Mostafaznv\LaraCache\DTOs\CacheEvent;
11
12
class RefreshCache implements ShouldQueue
13
{
14
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by Mostafaznv\LaraCache\Jobs\RefreshCache: $collectionClass, $id, $relations, $class, $keyBy
Loading history...
15
16
    public function __construct(
17
        private string     $model,
18
        private string     $name,
19
        private CacheEvent $event
20
    ) {}
21
22
    public function handle(): void
23
    {
24
        $model = app($this->model);
25
26
        $model->cache()->update($this->name, $this->event);
27
    }
28
}
29