Toolkit

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()  : false|array<string|int, mixed>
Returns content from given endpoint and fallback to mock if possible.
notifications()  : false|array<string|int, mixed>
Returns the notifications from the endpoint.
packages()  : false|array<string|int, 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()  : false|array<string|int, 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

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
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.

getWithMockFallback()

Returns content from given endpoint and fallback to mock if possible.

public static getWithMockFallback(string $url[, AuthorizationInterface|null $auth = null ]) : false|array<string|int, mixed>

This should only be executed on CI.

Parameters
$url : string

The QA endpoint url.

$auth : AuthorizationInterface|null = null

The authorization instance or null.

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

The content from given endpoint and fallback to mock if possible.

notifications()

Returns the notifications from the endpoint.

public static notifications() : false|array<string|int, mixed>
Return values
false|array<string|int, mixed>

The notifications from the endpoint.

packages()

Returns the packages reviews from the endpoint.

public static packages() : false|array<string|int, mixed>
Return values
false|array<string|int, mixed>

The packages review from the endpoint.

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

If the request fails.

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

The toolkit requirements.

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.

Loading…
On this page

Search results