Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 13 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | public function run($key, $value) |
||
38 | { |
||
39 | // TODO: replace both queries with a single UpdateWhere instead of find and update. |
||
40 | // this UpdateWhere will need to be added to the repository package (contribution). |
||
41 | |||
42 | $setting = $this->settingsRepository->findWhere(['key' => $key])->first(); |
||
43 | |||
44 | $result = $this->settingsRepository->update([ |
||
45 | 'value' => $value |
||
46 | ], $setting->id); |
||
47 | |||
48 | return $result; |
||
49 | } |
||
50 | |||
52 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.