Finish cleanup of available field generation

This commit is contained in:
Joshua Ramon Enslin 2022-11-07 15:48:00 +01:00
parent 7fd6b18af1
commit 2e349568e7
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
5 changed files with 28 additions and 25 deletions

View File

@ -14,14 +14,14 @@ final class CsvxmlAvailableFields {
const GENERAL_FIELD_MULTIPLIER = 1; const GENERAL_FIELD_MULTIPLIER = 1;
const EVENT_MULTIPLIER = 3; const EVENT_MULTIPLIER = 3;
/** @var array<mixed> /** @var array<string, array<string, FieldEntry>>
*/ */
private array $_availableFields; private array $_availableFields;
/** /**
* Getter for available fields. * Getter for available fields.
* *
* @return array<mixed> * @return array<string, array<string, FieldEntry>>
*/ */
public function getFields():array { public function getFields():array {
@ -32,13 +32,13 @@ final class CsvxmlAvailableFields {
/** /**
* Function for getting a simple array definition of an available field. * Function for getting a simple array definition of an available field.
* *
* @param string $nameTL Translation of the field name. Optional. * @param string $nameTL Translation of the field name. Optional.
* @param string $explica Explanation of the field (from musdb). Optional. * @param string $explica Explanation of the field (from musdb). Optional.
* @param array $dependsOn Dependent fields. Optional. * @param array<string> $dependsOn Dependent fields. Optional.
* @param array $allowedValues Allowed values. Optional. * @param array<string> $allowedValues Allowed values. Optional.
* @param string $remark Explanation of the field (for importer). Optional. * @param string $remark Explanation of the field (for importer). Optional.
* @param boolean $required Determines whether the field is required. Defaults * @param boolean $required Determines whether the field is required.
to false. * Optional, defaults to false.
* *
* @return FieldEntry * @return FieldEntry
*/ */
@ -62,7 +62,7 @@ final class CsvxmlAvailableFields {
* @param string $type Event type name (e.g. production). * @param string $type Event type name (e.g. production).
* @param integer $number Number of event of this type. * @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 { 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 { final class FieldEntry {
public bool $required; public readonly bool $required;
public array $allowedValues; public readonly string $remark;
public array $dependsOn; public readonly string $name_human_readable;
public string $remark; public readonly string $explica;
public string $name_human_readable;
public string $explica; /** @var array<string> */
public readonly array $allowedValues;
/** @var array<string> */
public readonly array $dependsOn;
/** /**
* Function for constructing a new FieldEntry Object. * Function for constructing a new FieldEntry Object.
* *
* @param boolean $required True if the field is required. * @param boolean $required True if the field is required.
* @param array $allowedValues Array of allowed values. * @param array<string> $allowedValues Array of allowed values.
* @param array $dependsOn Array of fields the entry depends on. * @param array<string> $dependsOn Array of fields the entry depends on.
* @param string $remark String variable. * @param string $remark Remark.
* @param string $name_human_readable Human readable translation. * @param string $name_human_readable Human readable translation.
* @param string $explica String variable * @param string $explica Explanation.
*/ */
public function __construct( public function __construct(
bool $required, array $allowedValues, bool $required, array $allowedValues,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long