Add enum MDNodaRepository and class MDNodaLink for the overarching data

structure
This commit is contained in:
2023-04-16 02:06:11 +02:00
parent d090d82dc2
commit 25f6694a92
3 changed files with 461 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<?PHP
/**
* Describes a reference to an external norm data repository.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Describes a reference to an external norm data repository.
*/
final class MDNodaLink {
public readonly MDNodaRepository $source;
public readonly string $id;
/**
* Constructor.
*
* @param MDNodaRepository $source Source repository.
* @param string $id ID.
*
* @return void
*/
public function __construct(MDNodaRepository $source, string $id) {
$this->source = $source;
if (($validatedId = $this->source->validateId(trim($id))) === false) {
throw new MDInvalidNodaLink("Invalid noda ID / link: " . $id . " [Repository: " . $this->source->toDbName() . "]");
}
$this->id = $validatedId;
}
}

1
src/classes/README.md Normal file
View File

@ -0,0 +1 @@
# Full-scale data types that provide further functionality but end up representing base data types