Report   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 22.58 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 7
loc 31
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A search() 7 7 1
A fetch() 0 6 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
declare(strict_types=1);
4
5
namespace Billogram\Api;
6
7
use Billogram\Model\Report\ReportCollection;
8
use Billogram\Model\Report\Report as Model;
9
use Psr\Http\Message\ResponseInterface;
10
11
/**
12
 * @see https://billogram.com/api/documentation#reports
13
 */
14
class Report extends HttpApi
15
{
16
    /**
17
     * @param array $param
18
     *
19
     * @return ReportCollection|ResponseInterface
20
     *
21
     * @see https://billogram.com/api/documentation#reports_list
22
     */
23 1 View Code Duplication
    public function search(array $param = [])
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...
24
    {
25 1
        $param = array_merge(['page' => 1, 'page_size' => 100], $param);
26 1
        $response = $this->httpGet('/report', $param);
27
28 1
        return $this->handleResponse($response, ReportCollection::class);
29
    }
30
31
    /**
32
     * @param string $fileName
33
     *
34
     * @return Model|ResponseInterface
35
     *
36
     * @see https://billogram.com/api/documentation#reports_fetch
37
     */
38 1
    public function fetch(string $fileName)
39
    {
40 1
        $response = $this->httpGet('/report/'.$fileName);
41
42 1
        return $this->handleResponse($response, Model::class);
43
    }
44
}
45