Utility class to parse and validate message group configurations. More...
Public Member Functions | |
getHopefullyValidConfigurations (string $data, ?callable $callback=null) | |
Easy to use function to get valid group configurations from YAML. | |
getDocumentsFromYaml (string $data) | |
Given a Yaml string, returns the non-empty documents as an array. | |
parseDocuments (array $documents) | |
Returns group configurations from YAML documents. | |
getBaseSchema () | |
validate (array $config) | |
Validates group configuration against schema. | |
Static Public Member Functions | |
static | mergeTemplate (array $base, array $specific) |
Merges a document template (base) to actual definition (specific) | |
Utility class to parse and validate message group configurations.
Definition at line 19 of file MessageGroupConfigurationParser.php.
MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupConfigurationParser::__construct | ( | ) |
Definition at line 23 of file MessageGroupConfigurationParser.php.
MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupConfigurationParser::getBaseSchema | ( | ) |
Definition at line 115 of file MessageGroupConfigurationParser.php.
MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupConfigurationParser::getDocumentsFromYaml | ( | string | $data | ) |
Given a Yaml string, returns the non-empty documents as an array.
Definition at line 78 of file MessageGroupConfigurationParser.php.
MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupConfigurationParser::getHopefullyValidConfigurations | ( | string | $data, |
?callable | $callback = null ) |
Easy to use function to get valid group configurations from YAML.
Those not matching schema will be ignored, if schema validation is enabled.
string | $data | Yaml |
callable | null | $callback | Optional callback which is called on errors. Parameters are document index, processed configuration and error message. |
Definition at line 41 of file MessageGroupConfigurationParser.php.
|
static |
Merges a document template (base) to actual definition (specific)
Definition at line 149 of file MessageGroupConfigurationParser.php.
MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupConfigurationParser::parseDocuments | ( | array | $documents | ) |
Returns group configurations from YAML documents.
If there is document containing template, it will be merged with other configurations.
Definition at line 88 of file MessageGroupConfigurationParser.php.
MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupConfigurationParser::validate | ( | array | $config | ) |
Validates group configuration against schema.
Exception | If configuration is not valid. |
Definition at line 123 of file MessageGroupConfigurationParser.php.