PagamentoExternoApi::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Integracao\ControlPay\API;
4
5
use GuzzleHttp\Exception\RequestException;
6
use Integracao\ControlPay\AbstractAPI;
7
use Integracao\ControlPay\Client;
8
use Integracao\ControlPay\Helpers\SerializerHelper;
9
use Integracao\ControlPay\Contracts;
10
11
/**
12
 * Class PagamentoExternoApi
13
 * @package Integracao\ControlPay\API
14
 */
15
class PagamentoExternoApi extends AbstractAPI
16
{
17
18
    /**
19
     * PagamentoExternoApi constructor.
20
     */
21
    public function __construct(Client $client = null)
22
    {
23
        parent::__construct('pagamentoExterno', $client);
24
    }
25
26
    /**
27
     * @param Contracts\PagamentoExterno\GetByFiltrosRequest $getByFiltrosRequest
28
     * @return Contracts\PagamentoExterno\GetByFiltrosResponse
29
     * @throws \Exception
30
     */
31 View Code Duplication
    public function getByFiltros(Contracts\PagamentoExterno\GetByFiltrosRequest $getByFiltrosRequest)
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...
32
    {
33
        try{
34
            $this->response = $this->_httpClient->post(__FUNCTION__,[
35
                'body' => json_encode($getByFiltrosRequest),
36
            ]);
37
38
            return SerializerHelper::denormalize(
39
                $this->response->json(),
40
                Contracts\PagamentoExterno\GetByFiltrosResponse::class
41
            );
42
        }catch (RequestException $ex) {
43
            $this->requestException($ex);
44
        }catch (\Exception $ex){
45
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
46
        }
47
    }
48
49
}