mini-fair-repo/inc/api/class-releasedocument.php
Ryan McCue a3a5a85baa Initial export of the repository
Signed-off-by: Ryan McCue <me@ryanmccue.info>
2025-06-05 12:06:13 +02:00

31 lines
No EOL
718 B
PHP

<?php
namespace MiniFAIR\API;
use JsonSerializable;
class ReleaseDocument implements JsonSerializable {
public string $version;
public array $requires;
public array $suggests;
public array $provides;
public array $artifacts;
protected function add_artifact( string $type, array $data ) : void {
if ( ! isset( $this->artifacts[ $type ] ) ) {
$this->artifacts[ $type ] = [];
}
$this->artifacts[ $type ][] = $data;
}
public function jsonSerialize() : array {
return [
'@context' => 'https://fair.pm/ns/release/v1',
'version' => $this->version,
'requires' => $this->requires,
'suggests' => $this->suggests,
'provides' => $this->provides,
'artifacts' => $this->artifacts,
];
}
}