RNEClient
in package
implements
RNEClientInterface
Class RNEClient
Table of Contents
Interfaces
Constants
- BASE_URI = 'https://registre-national-entreprises.inpi.fr/'
- DEFAULT_PAGE_SIZE = 20
- VALID_ACTIVITY_SECTORS = ['AGENT_COMMERCIAL', 'AGRICOLE_NON_ACTIF', 'ACTIF_AGRICOLE', 'ARTISANALE', 'ARTISANALE_REGLEMENTEE', 'COMMERCIALE', 'LIBERALE_REGLEMENTEE', 'LIBERALE_NON_REGLEMENTEE', 'GESTION_DE_BIENS', 'SANS_ACTIVITE']
Properties
Methods
- __construct() : mixed
- RNEClient constructor.
- authenticate() : void
- Authentify the user and store the token in the client
- getToken() : string
- Get the token
- addPageSizeToUrl() : string
- Add the page size parameter to the url
- addPageToUrl() : string
- Add the page parameter to the url
- catchResponseErrors() : void
- Catch the response errors
- decorateResponse() : array<string|int, mixed>
- add a decoration to the response resultsCount, hasMoreResults, nextPageUrl
- getAuthorizationHeaderArray() : array<string|int, mixed>
- Get the authorization header array
- requestApi() : array<string|int, mixed>
- Request the API
Constants
BASE_URI
public
mixed
BASE_URI
= 'https://registre-national-entreprises.inpi.fr/'
DEFAULT_PAGE_SIZE
public
mixed
DEFAULT_PAGE_SIZE
= 20
VALID_ACTIVITY_SECTORS
public
mixed
VALID_ACTIVITY_SECTORS
= ['AGENT_COMMERCIAL', 'AGRICOLE_NON_ACTIF', 'ACTIF_AGRICOLE', 'ARTISANALE', 'ARTISANALE_REGLEMENTEE', 'COMMERCIALE', 'LIBERALE_REGLEMENTEE', 'LIBERALE_NON_REGLEMENTEE', 'GESTION_DE_BIENS', 'SANS_ACTIVITE']
Properties
$client
private
Client
$client
$token
private
string|null
$token
Methods
__construct()
RNEClient constructor.
public
__construct([string|null $token = null ][, Client|null $client = null ]) : mixed
If a token is provided, it will be used for the requests Otherwise, the user will have to authenticate first
Parameters
- $token : string|null = null
- $client : Client|null = null
authenticate()
Authentify the user and store the token in the client
public
authenticate(string $username, string $password) : void
Parameters
- $username : string
- $password : string
Tags
getToken()
Get the token
public
getToken() : string
Return values
stringaddPageSizeToUrl()
Add the page size parameter to the url
protected
addPageSizeToUrl(string $url, int $pageSize) : string
Parameters
- $url : string
- $pageSize : int
Tags
Return values
stringaddPageToUrl()
Add the page parameter to the url
protected
addPageToUrl(string $url, int $page) : string
Parameters
- $url : string
- $page : int
Tags
Return values
stringcatchResponseErrors()
Catch the response errors
protected
catchResponseErrors(GuzzleException $e) : void
Parameters
- $e : GuzzleException
Tags
decorateResponse()
add a decoration to the response resultsCount, hasMoreResults, nextPageUrl
protected
decorateResponse(array<string|int, mixed> $data[, int $pageSize = self::DEFAULT_PAGE_SIZE ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $pageSize : int = self::DEFAULT_PAGE_SIZE
Tags
Return values
array<string|int, mixed>getAuthorizationHeaderArray()
Get the authorization header array
protected
getAuthorizationHeaderArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>requestApi()
Request the API
protected
requestApi(string $method, string $url[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
- $method : string
- $url : string
- $options : array<string|int, mixed> = []