Code Duplication    Length = 10-12 lines in 7 locations

Repositories/Cache/CacheSettingDecorator.php 7 locations

@@ 32-41 (lines=10) @@
29
     * @param $settingName
30
     * @return mixed
31
     */
32
    public function findByName($settingName)
33
    {
34
        return $this->cache
35
            ->tags($this->entityName, 'global')
36
            ->remember("{$this->locale}.{$this->entityName}.findByName.{$settingName}", $this->cacheTime,
37
                function () use ($settingName) {
38
                    return $this->repository->findByName($settingName);
39
                }
40
            );
41
    }
42
43
    /**
44
     * Return all modules that have settings
@@ 49-60 (lines=12) @@
46
     * @param  array|string $modules
47
     * @return array
48
     */
49
    public function moduleSettings($modules)
50
    {
51
        $moduleList = implode(',', $modules);
52
53
        return $this->cache
54
            ->tags($this->entityName, 'global')
55
            ->remember("{$this->locale}.{$this->entityName}.moduleSettings.{$moduleList}", $this->cacheTime,
56
                function () use ($modules) {
57
                    return $this->repository->moduleSettings($modules);
58
                }
59
            );
60
    }
61
62
    /**
63
     * Return the saved module settings
@@ 67-76 (lines=10) @@
64
     * @param $module
65
     * @return mixed
66
     */
67
    public function savedModuleSettings($module)
68
    {
69
        return $this->cache
70
            ->tags($this->entityName, 'global')
71
            ->remember("{$this->locale}.{$this->entityName}.savedModuleSettings.{$module}", $this->cacheTime,
72
                function () use ($module) {
73
                    return $this->repository->savedModuleSettings($module);
74
                }
75
            );
76
    }
77
78
    /**
79
     * Find settings by module name
@@ 83-92 (lines=10) @@
80
     * @param  string $module
81
     * @return mixed
82
     */
83
    public function findByModule($module)
84
    {
85
        return $this->cache
86
            ->tags($this->entityName, 'global')
87
            ->remember("{$this->locale}.{$this->entityName}.findByModule.{$module}", $this->cacheTime,
88
                function () use ($module) {
89
                    return $this->repository->findByModule($module);
90
                }
91
            );
92
    }
93
94
    /**
95
     * Find the given setting name for the given module
@@ 99-108 (lines=10) @@
96
     * @param  string $settingName
97
     * @return mixed
98
     */
99
    public function get($settingName)
100
    {
101
        return $this->cache
102
            ->tags($this->entityName, 'global')
103
            ->remember("{$this->locale}.{$this->entityName}.get.{$settingName}", $this->cacheTime,
104
                function () use ($settingName) {
105
                    return $this->repository->get($settingName);
106
                }
107
            );
108
    }
109
110
    /**
111
     * Return the translatable module settings
@@ 115-124 (lines=10) @@
112
     * @param $module
113
     * @return array
114
     */
115
    public function translatableModuleSettings($module)
116
    {
117
        return $this->cache
118
            ->tags($this->entityName, 'global')
119
            ->remember("{$this->locale}.{$this->entityName}.translatableModuleSettings.{$module}", $this->cacheTime,
120
                function () use ($module) {
121
                    return $this->repository->translatableModuleSettings($module);
122
                }
123
            );
124
    }
125
126
    /**
127
     * Return the non translatable module settings
@@ 131-140 (lines=10) @@
128
     * @param $module
129
     * @return array
130
     */
131
    public function plainModuleSettings($module)
132
    {
133
        return $this->cache
134
            ->tags($this->entityName, 'global')
135
            ->remember("{$this->locale}.{$this->entityName}.plainModuleSettings.{$module}", $this->cacheTime,
136
                function () use ($module) {
137
                    return $this->repository->plainModuleSettings($module);
138
                }
139
            );
140
    }
141
}
142