forked from museum-digital/MDAllowedValueSets
35 lines
877 B
PHP
35 lines
877 B
PHP
<?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;
|
|
|
|
}
|
|
}
|