Website
in package
Handle communications with QA api.
Table of Contents
Constants
- AUTHENTICATION_ENV_KEYS = ['auth' => 'QA_API_AUTH_TOKEN', 'basic' => 'QA_API_BASIC_AUTH']
Properties
- $url : string
- The default base url.
Methods
- apiAuth() : AuthorizationInterface|null
- Return the API Authorization instance.
- get() : string
- Curl function to access endpoint with or without authentication.
- getSessionToken() : string
- Helper to return the session token.
- getWithMockFallback() : mixed
- Returns content from given endpoint and fallback to mock if possible.
- notifications() : mixed
- Returns the notifications from the endpoint.
- packages() : mixed
- Returns the packages reviews from the endpoint.
- post() : string
- Helper to send a payload to the QA Website.
- projectConstraints() : false|array<string|int, mixed>
- Returns the Project constraints from the endpoint.
- projectInformation() : false|array<string|int, mixed>
- Returns the Project information from the endpoint.
- requirements() : mixed
- Returns the toolkit requirements from the endpoint.
- setUrl() : void
- Set the url to be used.
- url() : string
- Returns the QA website base url.
Constants
AUTHENTICATION_ENV_KEYS
protected
mixed
AUTHENTICATION_ENV_KEYS
= ['auth' => 'QA_API_AUTH_TOKEN', 'basic' => 'QA_API_BASIC_AUTH']
Properties
$url
The default base url.
protected
static string
$url
= 'https://digit-dqa.fpfis.tech.ec.europa.eu'
Methods
apiAuth()
Return the API Authorization instance.
public
static apiAuth() : AuthorizationInterface|null
Return values
AuthorizationInterface|null —The API authorization instance or empty string if fails.
get()
Curl function to access endpoint with or without authentication.
public
static get(string $url[, AuthorizationInterface|null $auth = null ]) : string
This function is made publicly available as a static function for other projects to call. Then we have to maintain less code.
Parameters
- $url : string
-
The QA endpoint url.
- $auth : AuthorizationInterface|null = null
-
The authorization instance or null.
Tags
Return values
string —The endpoint content, or empty string if no session is generated.
getSessionToken()
Helper to return the session token.
public
static getSessionToken() : string
Return values
string —The token or false if the request failed.
getWithMockFallback()
Returns content from given endpoint and fallback to mock if possible.
public
static getWithMockFallback(string $url[, AuthorizationInterface|null $auth = null ]) : mixed
This should only be executed on CI.
Parameters
- $url : string
-
The QA endpoint url.
- $auth : AuthorizationInterface|null = null
-
The authorization instance or null.
notifications()
Returns the notifications from the endpoint.
public
static notifications() : mixed
packages()
Returns the packages reviews from the endpoint.
public
static packages() : mixed
post()
Helper to send a payload to the QA Website.
public
static post(array<string|int, mixed> $fields, AuthorizationInterface $auth) : string
Parameters
- $fields : array<string|int, mixed>
-
Data to send.
- $auth : AuthorizationInterface
-
The authorization instance.
Tags
Return values
string —The endpoint response code, or empty string if no session is generated.
projectConstraints()
Returns the Project constraints from the endpoint.
public
static projectConstraints(string $projectId) : false|array<string|int, mixed>
Parameters
- $projectId : string
-
The project ID to use.
Tags
Return values
false|array<string|int, mixed> —An array with the constraints, false if fails.
projectInformation()
Returns the Project information from the endpoint.
public
static projectInformation(string $projectId) : false|array<string|int, mixed>
Parameters
- $projectId : string
-
The project ID to use.
Tags
Return values
false|array<string|int, mixed> —An array with the Project information, false if fails.
requirements()
Returns the toolkit requirements from the endpoint.
public
static requirements() : mixed
Tags
setUrl()
Set the url to be used.
public
static setUrl(string $url) : void
Parameters
- $url : string
-
The url to use.
url()
Returns the QA website base url.
public
static url() : string
If the environment variable QA_WEBSITE_URL exists, it will be used.
Return values
string —The base url.