Models   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 44
loc 44
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A paginate() 4 4 1
A get() 4 4 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 JulianoBailao\DomusApi\Endpoints\Secondary;
4
5
use JulianoBailao\DomusApi\Contracts\GetContract;
6
use JulianoBailao\DomusApi\Core\Endpoint;
7
8 View Code Duplication
class Models extends Endpoint implements GetContract
0 ignored issues
show
Duplication introduced by
This class 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...
9
{
10
    /**
11
     * The brand id.
12
     *
13
     * @var int
14
     */
15
    protected $brandId;
16
17
    /**
18
     * Create a new Models instance.
19
     *
20
     * @param int $brandId
21
     */
22 6
    public function __construct($client, $brandId)
23
    {
24 6
        parent::__construct($client);
25 6
        $this->brandId = $brandId;
26 6
    }
27
28
    /**
29
     * Get a page of models list.
30
     *
31
     * @param array $query the request query string.
32
     *
33
     * @return stdObject
34
     */
35 3
    public function paginate(array $query = [])
36
    {
37 3
        return $this->page('operacional/marcas/'.$this->brandId.'/modelos', $query);
38
    }
39
40
    /**
41
     * Get a specific model.
42
     *
43
     * @param int $id the model id.
44
     *
45
     * @return stdObject
46
     */
47 3
    public function get($id)
48
    {
49 3
        return $this->run('GET', 'operacional/marcas/'.$this->brandId.'/modelos/'.$id);
50
    }
51
}
52