Connection
in package
This is the Connection class in the LogiCommerce SDK package.
All LogiCommerce API connections are done through this class.
Tags
Table of Contents
CODE | = 'code' | |
---|---|---|
RESULT | = 'result' | |
STATUS | = 'status' | |
doRequest() | This will made a curl petition to the given API resource with the given method. | : array<string|int, mixed> |
getHost() | Returns the website host. | : string |
getInstance() | Returns the Connection instance. | : Connection |
getIp() | : string | |
getRequestHeaders() | Returns the request frequent needed headers. | : array<string|int, mixed> |
isHttps() | Returns if the website is being used with the secure protocol "https". | : string |
Constants
CODE
public
mixed
CODE
= 'code'
Tags
RESULT
public
mixed
RESULT
= 'result'
Tags
STATUS
public
mixed
STATUS
= 'status'
Tags
Methods
doRequest()
This will made a curl petition to the given API resource with the given method.
public
doRequest(Request $request[, string $apiUrl = null ]) : array<string|int, mixed>
The return will be the deserialized API response.
Parameters
- $request : Request
-
The request with all the needed data to send it
- $apiUrl : string = null
-
The URL of the API we want to do the request on
Tags
Return values
array<string|int, mixed> —getHost()
Returns the website host.
public
static getHost() : string
Return values
string —getInstance()
Returns the Connection instance.
public
static getInstance() : Connection
If is not setted, this method will set it.
Return values
Connection —getIp()
public
static getIp() : string
Return values
string —getRequestHeaders()
Returns the request frequent needed headers.
public
static getRequestHeaders() : array<string|int, mixed>
Those headers are:
- userAgent (HTTP_USER_AGENT)
- serverAddr (SERVER_ADDR)
- remoteAddr (REMOTE_ADDR)
- ip (Calculated. Not necessarily the same as "remoteAddr")
- referer (HTTP_REFERER)
- hostName (gethostname)
Return values
array<string|int, mixed> —isHttps()
Returns if the website is being used with the secure protocol "https".
public
static isHttps() : string