ProdutoApi::__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 ProdutoApi
13
 * @package Integracao\ControlPay\API
14
 */
15
class ProdutoApi extends AbstractAPI
16
{
17
18
    /**
19
     * ProdutoApi constructor.
20
     */
21
    public function __construct(Client $client = null)
22
    {
23
        parent::__construct('produto', $client);
24
    }
25
26
    /**
27
     * @param integer $pessoaId
28
     * @return Contracts\Venda\VenderResponse
29
     * @throws \Exception
30
     */
31 View Code Duplication
    public function getByAtivosByPessoaId($pessoaId)
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
                'query' => $this->addQueryAdditionalParameters([
36
                    'pessoaId' => $pessoaId
37
                ])
38
            ]);
39
40
            return SerializerHelper::denormalize(
41
                $this->response->json(),
42
                Contracts\Produto\GetByAtivosByPessoaIdResponse::class
43
            );
44
        }catch (RequestException $ex) {
45
            $this->requestException($ex);
46
        }catch (\Exception $ex){
47
            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
48
        }
49
    }
50
51
}