LabelLinkbaseParser
in package
Handles the parsing of XBRL label linkbase files, enabling the resolution of labels to taxonomy elements and storing them in a database.
Table of Contents
Properties
Methods
- __construct() : void
- Constructor method.
- parse() : void
- Parses the given XML file and processes its data for label resolution and taxonomy element association.
- ensureLabel() : void
- Ensures that a label exists for a given taxonomy element in the database.
- logSkippedLabel() : void
- Logs skipped labels during the XBRL label import process.
- normalizeRole() : string
- Normalizes the provided role string into a standardized role type.
Properties
$mySql
private
MySql
$mySql
$namespaceRegistry
private
NamespaceRegistry
$namespaceRegistry
Methods
__construct()
Constructor method.
public
__construct(MySql $mySql, NamespaceRegistry $namespaceRegistry) : void
Parameters
- $mySql : MySql
-
The MySql database connection instance.
- $namespaceRegistry : NamespaceRegistry
-
The namespace registry instance.
parse()
Parses the given XML file and processes its data for label resolution and taxonomy element association.
public
parse(string $file, LocatorResolver $resolver) : void
Parameters
- $file : string
-
The path to the XML file to parse.
- $resolver : LocatorResolver
-
The resolver used to load locators and resolve taxonomy elements.
Tags
ensureLabel()
Ensures that a label exists for a given taxonomy element in the database.
private
ensureLabel(int $taxonomyElementId, string $lang, string $label, string $role) : void
If a label with the same taxonomy element ID, language, and role already exists, it updates the label and normalized role.
Parameters
- $taxonomyElementId : int
-
The ID of the taxonomy element.
- $lang : string
-
The language of the label.
- $label : string
-
The label value to be inserted or updated.
- $role : string
-
The role associated with the label.
logSkippedLabel()
Logs skipped labels during the XBRL label import process.
private
logSkippedLabel(string $file, string $reason, string $from, string $to) : void
Parameters
- $file : string
-
The file path related to the skipped label.
- $reason : string
-
The reason why the label was skipped.
- $from : string
-
The original value or source of the label.
- $to : string
-
The target value or destination of the label.
normalizeRole()
Normalizes the provided role string into a standardized role type.
private
normalizeRole(string $role) : string
Parameters
- $role : string
-
The role string to normalize.
Return values
string —The normalized role type. Possible values: 'standard', 'terse', 'documentation', 'total', 'net', 'guidance', or 'other'.