Completed
Push — master ( f2b799...761b51 )
by Tobias
04:02
created

Report::fetch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
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
class Report extends HttpApi
12
{
13
    /**
14
     * @param string $fileName
15
     *
16
     * @return Model|ResponseInterface
17
     *
18
     * @see https://billogram.com/api/documentation#reports
19
     */
20 1
    public function fetch(string $fileName)
21
    {
22 1
        $response = $this->httpGet('/report/'.$fileName);
23
24 1
        return $this->handleResponse($response, Model::class);
25
    }
26
27
    /**
28
     * @param array $param
29
     *
30
     * @return ReportCollection|ResponseInterface
31
     *
32
     * @see https://billogram.com/api/documentation#reports
33
     */
34 1
    public function search(array $param = [])
35
    {
36 1
        $param = array_merge(['page' => 1, 'page_size' => 100], $param);
37 1
        $response = $this->httpGet('/report', $param);
38
39 1
        return $this->handleResponse($response, ReportCollection::class);
40
    }
41
}
42