Code Duplication    Length = 21-22 lines in 2 locations

src/Friends/Traits/Friendable.php 2 locations

@@ 180-201 (lines=22) @@
177
     * @param int|User $user
178
     * @return bool
179
     */
180
    public function acceptFriendRequestFrom($user)
181
    {
182
        $userId = $this->retrieveUserId($user);
183
184
        if ($userId == $this->getKey()) {
185
            // Method not allowed on self
186
            return false;
187
        }
188
189
        $relationship = $this->getPendingRequestFrom($userId);
190
191
        if (! is_null($relationship)) {
192
            $relationship->pivot->status = Status::ACCEPTED;
193
            $relationship->pivot->save();
194
            /* @todo: fire event friend request accepted */
195
            $this->reload();
196
197
            return true;
198
        }
199
200
        return false;
201
    }
202
203
    /**
204
     * @param int|User $user
@@ 207-227 (lines=21) @@
204
     * @param int|User $user
205
     * @return bool
206
     */
207
    public function denyFriendRequestFrom($user)
208
    {
209
        $userId = $this->retrieveUserId($user);
210
211
        if ($userId == $this->getKey()) {
212
            // Method not allowed on self
213
            return false;
214
        }
215
216
        $relationship = $this->getPendingRequestFrom($userId);
217
218
        if (! is_null($relationship)) {
219
            $relationship->pivot->delete();
220
            /* @todo: fire event friend request denied */
221
            $this->reload();
222
223
            return true;
224
        }
225
226
        return false;
227
    }
228
229
    /**
230
     * @param int|User $user