Toolkit

Website
in package

Handle communications with QA api.

Table of Contents

$url  : string
The default base url.
basicAuth()  : string
Return the QA API BASIC AUTH from token or from questions.
get()  : string
Curl function to access endpoint with or without authentication.
getSessionToken()  : string
Helper to return the session token.
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()  : array<string|int, mixed>|false|mixed
Returns the toolkit requirements from the endpoint.
setUrl()  : void
Set the url to be used.
url()  : string
Returns the QA website base url.

Properties

$url

The default base url.

protected static string $url = 'https://webgate.ec.europa.eu/fpfis/qa'

Methods

basicAuth()

Return the QA API BASIC AUTH from token or from questions.

public static basicAuth() : string
Return values
string —

The Basic auth or empty string if fails.

get()

Curl function to access endpoint with or without authentication.

public static get(string $url[, string $basicAuth = '' ]) : 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.

$basicAuth : string = ''

The basic auth.

Tags
throws
Exception

If the request fails.

SuppressWarnings

(PHPMD.MissingImport)

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.

post()

Helper to send a payload to the QA Website.

public static post(array<string|int, mixed> $fields, string $auth) : string
Parameters
$fields : array<string|int, mixed>

Data to send.

$auth : string

The Basic auth.

Tags
throws
Exception
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 $project_id) : false|array<string|int, mixed>
Parameters
$project_id : string

The project ID to use.

Tags
throws
Exception

If the request fails.

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 $project_id) : false|array<string|int, mixed>
Parameters
$project_id : string

The project ID to use.

Tags
throws
Exception

If the request fails.

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() : array<string|int, mixed>|false|mixed
Tags
throws
Exception

If the request fails.

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

setUrl()

Set the url to be used.

public static setUrl(string $url) : void
Parameters
$url : string

The url to use.

Return values
void —

url()

Returns the QA website base url.

public static url() : string
Return values
string —

The base url.

Search results