Documentation

BaseApi
in package

Classe responsável por reunir metodos comuns entre as classes que a implementem.

Faz injeção de dependencia do Guzzle/Client Definção de CNPJ para os logs Geração de UUID para consumo na API do FGTS Monta o contexLog com as informações de CNPJ e UUID

Table of Contents

Properties

$client  : Client
$cnpj  : string|null
$uuid  : string|null

Methods

__construct()  : mixed
makeRequest()  : array<string|int, mixed>|string
Makes an HTTP request using the specified method, URI, and options.
setCnpj()  : self
Define o CNPJ para contexto de logs
setUuid()  : self
Define o UUID para contexto de logs
getLogContext()  : array<string|int, mixed>
Retorna o contexto para logs

Properties

$cnpj

private string|null $cnpj = null

$uuid

private string|null $uuid = null

Methods

__construct()

public __construct(Client $client) : mixed
Parameters
$client : Client

makeRequest()

Makes an HTTP request using the specified method, URI, and options.

public makeRequest(string $method, string $uri[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>|string

Handles retries for connection exceptions, decodes JSON responses, and throws custom exceptions for errors.

Parameters
$method : string

The HTTP method to use (e.g., 'GET', 'POST').

$uri : string

The URI to request.

$options : array<string|int, mixed> = []

Optional request options to pass to the HTTP client.

Tags
access

public

throws
ApiClientException

If a connection error occurs after maximum retries, if the response JSON is invalid, or if any other request or unexpected error occurs.

Return values
array<string|int, mixed>|string

Returns the decoded JSON response as an array, or the raw response body as a string for non-JSON content.

setCnpj()

Define o CNPJ para contexto de logs

public setCnpj(string $cnpj) : self
Parameters
$cnpj : string
Return values
self

setUuid()

Define o UUID para contexto de logs

public setUuid(string $uuid) : self
Parameters
$uuid : string
Return values
self

getLogContext()

Retorna o contexto para logs

private getLogContext([array<string|int, mixed> $additionalContext = [] ]) : array<string|int, mixed>
Parameters
$additionalContext : array<string|int, mixed> = []
Return values
array<string|int, mixed>

        
On this page

Search results