mirror of
https://gh.wpcy.net/https://github.com/fairpm/mini-fair-repo.git
synced 2026-04-24 10:34:32 +08:00
31 lines
No EOL
718 B
PHP
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,
|
|
];
|
|
}
|
|
} |