Documentation

ReportFactRepository
in package

A repository class responsible for retrieving and normalizing fact data for reports.

Table of Contents

Properties

$mySql  : MySql

Methods

__construct()  : mixed
getFactsForReport()  : array<string|int, mixed>
Retrieves a list of facts for a report based on the specified company plant and taxonomy version.
derivePeriodEnd()  : string|null
Derives the end date of the year based on the provided date.
derivePeriodStart()  : string|null
Derives the start of the period based on the provided date.
extractValue()  : array<string|int, mixed>|null
Extracts and formats the value details from a given data row.
mapUnitCodeToMeasure()  : string
Maps a given unit code to its corresponding measure representation.
normalizeDate()  : string|null
Normalizes the given value to a date string in the format 'YYYY-MM-DD'.
normalizeFactRow()  : array<string|int, mixed>|null
Normalizes a fact row by extracting and transforming relevant data into a structured array.
normalizeNumeric()  : string
Normalizes the given value to a numeric string representation.

Properties

Methods

getFactsForReport()

Retrieves a list of facts for a report based on the specified company plant and taxonomy version.

public getFactsForReport(int $companyPlantId, int $taxonomyVersionId[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$companyPlantId : int

The ID of the company plant for which facts are to be retrieved.

$taxonomyVersionId : int

The ID of the taxonomy version to filter the facts.

$options : array<string|int, mixed> = []

Optional parameters, which may include:

  • 'entity_identifier' (string): The entity identifier to use, defaults to '529900PLACEHOLDER'.
  • 'entity_scheme' (string): The entity scheme to use, defaults to 'http://standards.iso.org/iso/17442'.
Return values
array<string|int, mixed> —

An array of normalized fact data for the specified company plant and taxonomy version.

derivePeriodEnd()

Derives the end date of the year based on the provided date.

private derivePeriodEnd(string|null $date) : string|null
Parameters
$date : string|null

The input date in the format 'YYYY-MM-DD' or null.

Return values
string|null —

The derived end date in the format 'YYYY-12-31' or null if input date is null.

derivePeriodStart()

Derives the start of the period based on the provided date.

private derivePeriodStart(string|null $date) : string|null
Parameters
$date : string|null

The input date in the format 'YYYY-MM-DD' or null.

Return values
string|null —

The start of the period in the format 'YYYY-01-01', or null if the input is null.

extractValue()

Extracts and formats the value details from a given data row.

private extractValue(array<string|int, mixed> $row) : array<string|int, mixed>|null
Parameters
$row : array<string|int, mixed>

The data row containing various amount and unit fields.

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

An associative array containing 'value', 'decimals', and 'unit_measure' if a valid value exists, or null if no value can be extracted.

mapUnitCodeToMeasure()

Maps a given unit code to its corresponding measure representation.

private mapUnitCodeToMeasure(string $unitCode) : string
Parameters
$unitCode : string

The unit code to be mapped. It is case-insensitive and can include codes such as 'EUR', 'USD', 'GBP', or empty strings.

Return values
string —

The mapped measure representation, such as 'xbrli:pure' for pure units, 'iso4217:EUR' for Euros, or a formatted unit when no predefined mapping exists.

normalizeDate()

Normalizes the given value to a date string in the format 'YYYY-MM-DD'.

private normalizeDate(mixed $value) : string|null
Parameters
$value : mixed

The value to be normalized. Can be null, an empty string, or any value that can be cast to a string.

Return values
string|null —

The normalized date string if the value is valid, or null if the value is null or an empty string.

normalizeFactRow()

Normalizes a fact row by extracting and transforming relevant data into a structured array.

private normalizeFactRow(array<string|int, mixed> $row, string $entityIdentifier, string $entityScheme) : array<string|int, mixed>|null
Parameters
$row : array<string|int, mixed>

The raw data row containing fact information.

$entityIdentifier : string

The identifier of the entity associated with the fact.

$entityScheme : string

The scheme or type of the entity associated with the fact.

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

The normalized fact row as an associative array, or null if the row cannot be normalized.

normalizeNumeric()

Normalizes the given value to a numeric string representation.

private normalizeNumeric(mixed $value) : string
Parameters
$value : mixed

The value to normalize. It can be of any type, including null, string, or numeric.

Return values
string —

The normalized numeric string representation of the given value.


        
On this page

Search results