Total Complexity | 8 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class UpdateCacheAction extends UpdateDeleteCache |
||
9 | { |
||
10 | public function run(CommandData $data): void |
||
11 | { |
||
12 | if (count($data->models) > 1) { |
||
13 | foreach ($data->models as $model) { |
||
14 | $this->updateAll($model); |
||
15 | } |
||
16 | } |
||
17 | else { |
||
18 | $model = $data->models[0]; |
||
19 | |||
20 | empty($data->entities) |
||
21 | ? $this->updateAll($model) |
||
22 | : $this->update($model, $data->entities); |
||
23 | } |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @param \Mostafaznv\LaraCache\Traits\LaraCache $model |
||
28 | * @return void |
||
29 | */ |
||
30 | private function updateAll(string $model): void |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @param \Mostafaznv\LaraCache\Traits\LaraCache $model |
||
43 | * @param array $entities |
||
44 | * @return void |
||
45 | */ |
||
46 | private function update(string $model, array $entities): void |
||
61 |