Brands   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 38
loc 38
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

3 Methods

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