Code Duplication    Length = 13-15 lines in 4 locations

src/Api/Customer.php 1 location

@@ 25-37 (lines=13) @@
22
     *
23
     * @see https://billogram.com/api/documentation#customers_list
24
     */
25
    public function search(array $param = [])
26
    {
27
        $param = array_merge(['page' => 1, 'page_size' => 100], $param);
28
        $response = $this->httpGet('/customer', $param);
29
        if (!$this->hydrator) {
30
            return $response;
31
        }
32
        if ($response->getStatusCode() !== 200) {
33
            $this->handleErrors($response);
34
        }
35
36
        return $this->hydrator->hydrate($response, CustomerCollection::class);
37
    }
38
39
    /**
40
     * @param int $customerNo

src/Api/Invoice.php 1 location

@@ 24-38 (lines=15) @@
21
     *
22
     * @see https://billogram.com/api/documentation#billogram_call_create
23
     */
24
    public function search(array $param = [])
25
    {
26
        $param = array_merge(['page' => 1, 'page_size' => 100], $param);
27
        $response = $this->httpGet('/billogram', $param);
28
        if (!$this->hydrator) {
29
            return $response;
30
        }
31
32
        // Use any valid status code here
33
        if ($response->getStatusCode() !== 200) {
34
            $this->handleErrors($response);
35
        }
36
37
        return $this->hydrator->hydrate($response, InvoiceCollection::class);
38
    }
39
40
    /**
41
     * @param string $invoiceId

src/Api/Item.php 1 location

@@ 24-37 (lines=14) @@
21
     *
22
     * @see https://billogram.com/api/documentation#items_list
23
     */
24
    public function search(array $param = [])
25
    {
26
        $param = array_merge(['page' => 1, 'page_size' => 100], $param);
27
        $response = $this->httpGet('/item', $param);
28
        if (!$this->hydrator) {
29
            return $response;
30
        }
31
        // Use any valid status code here
32
        if ($response->getStatusCode() !== 200) {
33
            $this->handleErrors($response);
34
        }
35
36
        return $this->hydrator->hydrate($response, CollectionItem::class);
37
    }
38
39
    /**
40
     * @param string $itemNo

src/Api/Report.php 1 location

@@ 41-54 (lines=14) @@
38
     *
39
     * @see https://billogram.com/api/documentation#reports
40
     */
41
    public function search(array $param = [])
42
    {
43
        $param = array_merge(['page' => 1, 'page_size' => 100], $param);
44
        $response = $this->httpGet('/report', $param);
45
        if (!$this->hydrator) {
46
            return $response;
47
        }
48
        // Use any valid status code here
49
        if ($response->getStatusCode() !== 200) {
50
            $this->handleErrors($response);
51
        }
52
53
        return $this->hydrator->hydrate($response, ReportCollection::class);
54
    }
55
}
56