WrapItApiRequester   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 60.87 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 60%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 14
loc 23
ccs 9
cts 15
cp 0.6
rs 10
c 2
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A get() 7 7 1
A post() 7 7 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 WrapIt\Http;
4
5
/**
6
 * Class WrapItApiRequester
7
 *
8
 * @package WrapIt
9
 */
10
class WrapItApiRequester extends Requester {
11
12 48
    public function __construct($domain) {
13 48
        $this->domain = $domain;
14 48
    }
15
16 View Code Duplication
    public function get($api, $data = array()) {
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
        $api = ltrim($api, "/");
18
        return $this->request(array(
19
            "url" => "https://" . $this->domain . "/" . $api,
20
            "get" => $data
21
        ));
22
    }
23
24 12 View Code Duplication
    public function post($api, $data) {
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...
25 12
        $api = ltrim($api, "/");
26 12
        return $this->request(array(
27 12
            "url" => "https://" . $this->domain . "/" . $api,
28 6
            "post" => $data
29 6
        ));
30
    }
31
32
}
33