Finish cleanup of available field generation

This commit is contained in:
2022-11-07 15:48:00 +01:00
parent 7fd6b18af1
commit 2e349568e7
5 changed files with 28 additions and 25 deletions

View File

@ -14,14 +14,14 @@ final class CsvxmlAvailableFields {
const GENERAL_FIELD_MULTIPLIER = 1;
const EVENT_MULTIPLIER = 3;
/** @var array<mixed>
/** @var array<string, array<string, FieldEntry>>
*/
private array $_availableFields;
/**
* Getter for available fields.
*
* @return array<mixed>
* @return array<string, array<string, FieldEntry>>
*/
public function getFields():array {
@ -32,13 +32,13 @@ final class CsvxmlAvailableFields {
/**
* Function for getting a simple array definition of an available field.
*
* @param string $nameTL Translation of the field name. Optional.
* @param string $explica Explanation of the field (from musdb). Optional.
* @param array $dependsOn Dependent fields. Optional.
* @param array $allowedValues Allowed values. Optional.
* @param string $remark Explanation of the field (for importer). Optional.
* @param boolean $required Determines whether the field is required. Defaults
to false.
* @param string $nameTL Translation of the field name. Optional.
* @param string $explica Explanation of the field (from musdb). Optional.
* @param array<string> $dependsOn Dependent fields. Optional.
* @param array<string> $allowedValues Allowed values. Optional.
* @param string $remark Explanation of the field (for importer). Optional.
* @param boolean $required Determines whether the field is required.
* Optional, defaults to false.
*
* @return FieldEntry
*/
@ -62,7 +62,7 @@ final class CsvxmlAvailableFields {
* @param string $type Event type name (e.g. production).
* @param integer $number Number of event of this type.
*
* @return FieldEntry
* @return array<string, FieldEntry>
*/
private function _generateGenericFullEvent(MDTlLoader $tlLoader, string $typeName, string $type, int $number):array {

View File

@ -11,22 +11,25 @@ declare(strict_types = 1);
*/
final class FieldEntry {
public bool $required;
public array $allowedValues;
public array $dependsOn;
public string $remark;
public string $name_human_readable;
public string $explica;
public readonly bool $required;
public readonly string $remark;
public readonly string $name_human_readable;
public readonly string $explica;
/** @var array<string> */
public readonly array $allowedValues;
/** @var array<string> */
public readonly array $dependsOn;
/**
* Function for constructing a new FieldEntry Object.
*
* @param boolean $required True if the field is required.
* @param array $allowedValues Array of allowed values.
* @param array $dependsOn Array of fields the entry depends on.
* @param string $remark String variable.
* @param string $name_human_readable Human readable translation.
* @param string $explica String variable
* @param boolean $required True if the field is required.
* @param array<string> $allowedValues Array of allowed values.
* @param array<string> $dependsOn Array of fields the entry depends on.
* @param string $remark Remark.
* @param string $name_human_readable Human readable translation.
* @param string $explica Explanation.
*/
public function __construct(
bool $required, array $allowedValues,