Code Duplication    Length = 16-17 lines in 4 locations

src/Harvest.php 2 locations

@@ 42-58 (lines=17) @@
39
     * @param  $timerId
40
     * @return mixed
41
     */
42
    public function deleteTimer($timerId = null)
43
    {
44
        $res = false;
45
46
        if ($this->serviceApiCall->send('delete', 'delete/' . $timerId) === true) {
47
            if ($this->serviceApiCall->last('success') === true) {
48
                $this->setMessage('timer deleted');
49
                $res = true;
50
            } else {
51
                $this->setMessage('could not delete timer!');
52
            }
53
        } else {
54
            $this->setMessage($this->serviceApiCall->getMessage());
55
        }
56
57
        return $res;
58
    }
59
60
    /**
61
     * @return mixed
@@ 128-143 (lines=16) @@
125
     * @param  $timerId
126
     * @return mixed
127
     */
128
    private function isTimerRunning($timerId)
129
    {
130
        $res = false;
131
132
        if ($this->serviceApiCall->send('get', 'show/' . $timerId) === true) {
133
            if ($this->serviceApiCall->last('success') === true) {
134
                if (isset($this->serviceApiCall->getData()['timer_started_at']) === true) {
135
                    $res = true;
136
                }
137
            }
138
        } else {
139
            $this->setMessage($this->serviceApiCall->getMessage());
140
        }
141
142
        return $res;
143
    }
144
145
    /**
146
     * @param $message

src/Toggl.php 2 locations

@@ 41-57 (lines=17) @@
38
     * @param  $timerId
39
     * @return mixed
40
     */
41
    public function deleteTimer($timerId = null)
42
    {
43
        $res = false;
44
45
        if ($this->serviceApiCall->send('delete', 'time_entries/' . $timerId) === true) {
46
            if ($this->serviceApiCall->last('success') === true) {
47
                $this->setMessage('timer deleted');
48
                $res = true;
49
            } else {
50
                $this->setMessage('could not delete timer!');
51
            }
52
        } else {
53
            $this->setMessage($this->serviceApiCall->getMessage());
54
        }
55
56
        return $res;
57
    }
58
59
    /**
60
     * @return mixed
@@ 140-156 (lines=17) @@
137
     * @param  $timerId
138
     * @return mixed
139
     */
140
    public function stopTimer($timerId = null)
141
    {
142
        $res = false;
143
144
        if ($this->serviceApiCall->send('put', 'time_entries/' . $timerId . '/stop') === true) {
145
            if ($this->serviceApiCall->last('success') === true) {
146
                $this->setMessage('timer stopped');
147
                $res = true;
148
            } else {
149
                $this->setMessage('could not stop timer!');
150
            }
151
        } else {
152
            $this->setMessage($this->serviceApiCall->getMessage());
153
        }
154
155
        return $res;
156
    }
157
158
    /**
159
     * @param $message