Completed
Pull Request — master (#19)
by Sergey
03:17
created

Interests   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 57.89 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 22
loc 38
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A follow() 11 11 1
A unFollow() 11 11 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace seregazhuk\PinterestBot\Api\Providers;
4
5
use seregazhuk\PinterestBot\Api\Request;
6
use seregazhuk\PinterestBot\Helpers\UrlHelper;
7
8
class Interests extends Provider
9
{
10
    /**
11
     * Follow interest by ID
12
     *
13
     * @param int $interestId
14
     * @return bool
15
     */
16 View Code Duplication
    public function follow($interestId)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

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.

Loading history...
17
    {
18
        $this->request->checkLoggedIn();
19
20
        $response = $this->request->followMethodCall(
21
            $interestId,
22
            Request::INTEREST_ENTITY_ID,
23
            UrlHelper::RESOURCE_FOLLOW_INTEREST
24
        );
25
        return $this->response->checkResponse($response);
26
    }
27
28
    /**
29
     * Unfollow interest by ID
30
     *
31
     * @param int $interestId
32
     * @return bool
33
     */
34 View Code Duplication
    public function unFollow($interestId)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

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.

Loading history...
35
    {
36
        $this->request->checkLoggedIn();
37
38
        $response = $this->request->followMethodCall(
39
            $interestId,
40
            Request::INTEREST_ENTITY_ID,
41
            UrlHelper::RESOURCE_UNFOLLOW_INTEREST
42
        );
43
        return $this->response->checkResponse($response);
44
    }
45
}
46