Categories::subcategories()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
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\Subcategories;
8
9 View Code Duplication
class Categories 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 categories list.
13
     *
14
     * @param array $query the request query string.
15
     *
16
     * @return stdObject
17
     */
18 3
    public function paginate(array $query = [])
19
    {
20 3
        return $this->page('operacional/categorias', $query);
21
    }
22
23
    /**
24
     * Get a specific category.
25
     *
26
     * @param int $id the category id.
27
     *
28
     * @return stdObject
29
     */
30 3
    public function get($id)
31
    {
32 3
        return $this->run('GET', 'operacional/categorias/'.$id);
33
    }
34
35
    /**
36
     * Get the Subcategories endpoint from a category.
37
     *
38
     * @param int $brandId
39
     *
40
     * @return Subcategories
41
     */
42 6
    public function subcategories($brandId)
43
    {
44 6
        return new Subcategories($this->client, $brandId);
45
    }
46
}
47