Code Duplication    Length = 12-16 lines in 4 locations

src/Time.php 4 locations

@@ 96-111 (lines=16) @@
93
    /**
94
     * @return mixed
95
     */
96
    public function getProjects()
97
    {
98
        $projects = [];
99
100
/*
101
 * Temporary, only get the projects of Toggl
102
 * Later, we will get Harvest ones too
103
 */
104
        foreach ($this->config->implementedServicesForFeature('get_projects') as $service) {
105
            if ($this->config->isServiceActive($service) === true) {
106
                $projects = $this->$service->getProjects($this->getServiceDataCache($service));
107
            }
108
        }
109
110
        return $projects;
111
    }
112
113
    /**
114
     * @return mixed
@@ 116-127 (lines=12) @@
113
    /**
114
     * @return mixed
115
     */
116
    public function getRecentTimers()
117
    {
118
        $timers = [];
119
120
        foreach ($this->config->implementedServicesForFeature('get_timers') as $service) {
121
            if ($this->config->isServiceActive($service) === true) {
122
                $timers = array_merge($timers, $this->getRecentServiceTimers($service));
123
            }
124
        }
125
126
        return $timers;
127
    }
128
129
    /**
130
     * @param  $service
@@ 148-159 (lines=12) @@
145
    /**
146
     * @return mixed
147
     */
148
    public function getTags()
149
    {
150
        $tags = [];
151
152
/*
153
 * Temporary, only get the tags of Toggl
154
 * Later, we will get Harvest ones too
155
 */
156
        foreach ($this->config->implementedServicesForFeature('get_tags') as $service) {
157
            if ($this->config->isServiceActive($service) === true) {
158
                $tags = $this->$service->getTags($this->getServiceDataCache($service));
159
            }
160
        }
161
162
        return $tags;
@@ 264-275 (lines=12) @@
261
    /**
262
     * @return string
263
     */
264
    public function syncOnlineDataToLocalCache()
265
    {
266
        $message = '';
267
268
        foreach ($this->config->implementedServicesForFeature('sync_data') as $service) {
269
            if ($this->config->isServiceActive($service) === true) {
270
                $message .= $this->syncServiceOnlineDataToLocalCache($service);
271
            }
272
        }
273
274
        return $message;
275
    }
276
277
    /**
278
     * @return string