Documentation

ReportAssembler
in package

The ReportAssembler class is responsible for assembling and rendering structured reports based on provided data and taxonomy configurations. It provides methods to create complete report documents in various formats, including XHTML and XML.

Table of Contents

Properties

$contextBuilder  : ContextBuilder
$factMapper  : FactMapper
$renderer  : XhtmlIxbrlRenderer
$reportFactRepository  : ReportFactRepository
$taxonomyReaderService  : TaxonomyReaderService
$unitBuilder  : UnitBuilder

Methods

__construct()  : void
Constructor method for initializing dependencies.
assembleDocument()  : array<string|int, mixed>
Assembles a document based on the provided report ID and options.
renderReport()  : string
Renders a report identified by the given report ID and options.
renderXmlReport()  : string
Renders an XML report based on the provided report ID and options.
buildBody()  : array<string|int, mixed>
Builds the body structure of a report consisting of cover pages, table of contents, main content, and fallback sections for unmapped or unplaced facts.
buildNamespaceMap()  : array<string|int, mixed>
Builds and returns a mapping of namespace prefixes to their corresponding URIs.
buildPresentationSubtree()  : array<string|int, mixed>
Builds a structured subtree representation for a presentation hierarchy.
buildTocItems()  : array<string|int, mixed>
Builds a list of Table of Contents (TOC) items based on the given taxonomy facts and language.
subtreeHasFacts()  : bool
Determines if a subtree contains any facts, either directly associated with the given element or within its child elements.

Properties

Methods

__construct()

Constructor method for initializing dependencies.

public __construct(ReportFactRepository $reportFactRepository, TaxonomyReaderService $taxonomyReaderService, FactMapper $factMapper, ContextBuilder $contextBuilder, UnitBuilder $unitBuilder, XhtmlIxbrlRenderer $renderer) : void
Parameters
$reportFactRepository : ReportFactRepository

Instance of ReportFactRepository.

$taxonomyReaderService : TaxonomyReaderService

Instance of TaxonomyReaderService.

$factMapper : FactMapper

Instance of FactMapper.

$contextBuilder : ContextBuilder

Instance of ContextBuilder.

$unitBuilder : UnitBuilder

Instance of UnitBuilder.

$renderer : XhtmlIxbrlRenderer

Instance of XhtmlIxbrlRenderer.

assembleDocument()

Assembles a document based on the provided report ID and options.

public assembleDocument(int $reportId[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$reportId : int

The ID of the report to assemble the document for.

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

Optional parameters for document assembly:

  • 'title' (string): Title of the document. Defaults to 'Sustainability Statement'.
  • 'lang' (string): Language of the document. Defaults to 'en'.
  • 'taxonomy_version_id' (int): The ID of the taxonomy version (required).
  • 'company_name' (string): Name of the company. Defaults to 'Your Company Name'.
Tags
throws
RuntimeException

If 'taxonomy_version_id' is not provided or is invalid.

Return values
array<string|int, mixed>

An array containing the assembled document:

  • 'title' (string): The title of the document.
  • 'lang' (string): The language of the document.
  • 'taxonomy_namespaces' (array): Mapping of taxonomy namespaces.
  • 'contexts' (array): All context elements used in the document.
  • 'units' (array): All unit elements used in the document.
  • 'body' (mixed): The body content of the assembled document.

renderReport()

Renders a report identified by the given report ID and options.

public renderReport(int $reportId[, array<string|int, mixed> $options = [] ]) : string
Parameters
$reportId : int

The unique identifier of the report to render.

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

Optional configuration options for rendering the report.

Return values
string

The rendered report as a string.

renderXmlReport()

Renders an XML report based on the provided report ID and options.

public renderXmlReport(int $reportId[, array<string|int, mixed> $options = [] ]) : string
Parameters
$reportId : int

The identifier of the report to be rendered.

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

Optional configuration settings for rendering the report.

Return values
string

The rendered XML report as a string.

buildBody()

Builds the body structure of a report consisting of cover pages, table of contents, main content, and fallback sections for unmapped or unplaced facts.

private buildBody(array<string|int, mixed> $factsByConceptId, string $lang, string $title, string $companyName) : array<string|int, mixed>
Parameters
$factsByConceptId : array<string|int, mixed>

An associative array where the keys are concept IDs and the values are arrays of facts.

$lang : string

The language code used for fetching labels and presentation nodes.

$title : string

The title of the report.

$companyName : string

The name of the company for which the report is being generated.

Return values
array<string|int, mixed>

An array representing the structured body of the report.

buildNamespaceMap()

Builds and returns a mapping of namespace prefixes to their corresponding URIs.

private buildNamespaceMap() : array<string|int, mixed>
Return values
array<string|int, mixed>

An associative array where keys are namespace prefixes and values are their respective URIs.

buildPresentationSubtree()

Builds a structured subtree representation for a presentation hierarchy.

private buildPresentationSubtree(int $elementId, array<string|int, mixed> $factsByConceptId, array<string|int, mixed> &$usedConceptIds, array<string|int, mixed> &$renderedInBranch, string $branchKey, string $lang, int $depth) : array<string|int, mixed>
Parameters
$elementId : int

The ID of the taxonomy element to process.

$factsByConceptId : array<string|int, mixed>

An associative array mapping concept IDs to their associated facts.

$usedConceptIds : array<string|int, mixed>

A reference to an array of concept IDs that have already been used in processing.

$renderedInBranch : array<string|int, mixed>

A reference to an array tracking which elements have been rendered within the current branch.

$branchKey : string

A unique key representing the current branch of the presentation tree.

$lang : string

The language code used for retrieving localized labels and content.

$depth : int

The current depth of the subtree being processed, used to determine heading levels.

Return values
array<string|int, mixed>

The structured subtree as an array, including content and any child nodes.

buildTocItems()

Builds a list of Table of Contents (TOC) items based on the given taxonomy facts and language.

private buildTocItems(array<string|int, mixed> $factsByConceptId, string $lang) : array<string|int, mixed>
Parameters
$factsByConceptId : array<string|int, mixed>

An associative array mapping concept IDs to their associated facts.

$lang : string

The language code used for retrieving localized labels and content.

Return values
array<string|int, mixed>

The list of TOC items as an array of strings, each representing a label for a taxonomy element.

subtreeHasFacts()

Determines if a subtree contains any facts, either directly associated with the given element or within its child elements.

private subtreeHasFacts(int $elementId, array<string|int, mixed> $factsByConceptId, string $lang) : bool
Parameters
$elementId : int

The ID of the taxonomy element to check for facts.

$factsByConceptId : array<string|int, mixed>

An associative array mapping concept IDs to their associated facts.

$lang : string

The language code used for retrieving children of the taxonomy element.

Return values
bool

True if the subtree contains facts; otherwise, false.


        
On this page

Search results