Conditions | 5 |
Paths | 4 |
Total Lines | 27 |
Code Lines | 15 |
Lines | 8 |
Ratio | 29.63 % |
Tests | 16 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
40 | 4 | public function handle() |
|
41 | { |
||
42 | 4 | $this->comment('Clearing settings cache.'); |
|
43 | 4 | $settings = Settings::all(); |
|
44 | |||
45 | 4 | foreach ($settings as $key => $value) { |
|
46 | 2 | $cache_key = Settings::cacheKey($key); |
|
47 | |||
48 | 2 | Cache::forget($cache_key); |
|
49 | } |
||
50 | |||
51 | 4 | $model = $this->option('model'); |
|
52 | |||
53 | 4 | if (isset($model)) { |
|
54 | 2 | $users = (new $model)->all(); |
|
55 | 2 | View Code Duplication | foreach ($users as $user) { |
56 | 2 | $settings = $user->allSettings(); |
|
57 | 2 | foreach ($settings as $key => $value) { |
|
58 | 2 | $cache_key = $user->settingsCacheKey($key); |
|
59 | |||
60 | 2 | Cache::forget($cache_key); |
|
61 | } |
||
62 | } |
||
63 | } |
||
64 | |||
65 | 4 | $this->info('Cleared ' . count($settings) . ' settings cache.'); |
|
66 | 4 | } |
|
67 | } |
||
68 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.