2024-05-06 16:00:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Modules\Plugins\Manifest;
|
|
|
|
|
|
|
|
use CodeIgniter\HTTP\URI;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @property string $name
|
|
|
|
* @property string $version
|
|
|
|
* @property ?string $description
|
2024-05-09 17:55:41 +00:00
|
|
|
* @property Person[] $authors
|
|
|
|
* @property Person[] $contributors
|
2024-05-06 16:00:47 +00:00
|
|
|
* @property ?URI $homepage
|
|
|
|
* @property ?string $license
|
|
|
|
* @property bool $private
|
|
|
|
* @property list<string> $keywords
|
2024-07-05 16:47:01 +00:00
|
|
|
* @property ?string $minCastopodVersion
|
2024-05-06 16:00:47 +00:00
|
|
|
* @property list<string> $hooks
|
|
|
|
* @property ?Settings $settings
|
2024-05-09 17:55:41 +00:00
|
|
|
* @property ?Repository $repository
|
2024-05-06 16:00:47 +00:00
|
|
|
*/
|
|
|
|
class Manifest extends ManifestObject
|
|
|
|
{
|
2024-12-23 15:35:47 +00:00
|
|
|
public static array $validation_rules = [
|
2024-07-05 16:47:01 +00:00
|
|
|
'name' => 'required|max_length[128]|regex_match[/^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9]([_.-]?[a-z0-9]+)*$/]',
|
|
|
|
'version' => 'required|regex_match[/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/]',
|
|
|
|
'description' => 'permit_empty|max_length[256]',
|
|
|
|
'authors' => 'permit_empty|is_list',
|
|
|
|
'homepage' => 'permit_empty|valid_url_strict',
|
|
|
|
'license' => 'permit_empty|string',
|
|
|
|
'private' => 'permit_empty|is_boolean',
|
|
|
|
'keywords.*' => 'permit_empty',
|
|
|
|
'minCastopodVersion' => 'permit_empty|regex_match[/^(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/]',
|
|
|
|
'hooks.*' => 'permit_empty|in_list[rssBeforeChannel,rssAfterChannel,rssBeforeItem,rssAfterItem,siteHead]',
|
|
|
|
'settings' => 'permit_empty|is_list',
|
|
|
|
'repository' => 'permit_empty|is_list',
|
2024-05-06 16:00:47 +00:00
|
|
|
];
|
|
|
|
|
2024-12-23 15:35:47 +00:00
|
|
|
protected array $casts = [
|
2024-05-09 17:55:41 +00:00
|
|
|
'authors' => [Person::class],
|
|
|
|
'homepage' => URI::class,
|
|
|
|
'settings' => Settings::class,
|
|
|
|
'repository' => Repository::class,
|
2024-05-06 16:00:47 +00:00
|
|
|
];
|
|
|
|
|
2024-05-16 15:53:42 +00:00
|
|
|
protected ?string $name = '???';
|
2024-05-06 16:00:47 +00:00
|
|
|
|
2024-05-16 15:53:42 +00:00
|
|
|
protected ?string $version = 'X.Y.Z';
|
2024-05-06 16:00:47 +00:00
|
|
|
|
|
|
|
protected ?string $description = null;
|
|
|
|
|
|
|
|
/**
|
2024-05-09 17:55:41 +00:00
|
|
|
* @var Person[]
|
2024-05-06 16:00:47 +00:00
|
|
|
*/
|
|
|
|
protected array $authors = [];
|
|
|
|
|
|
|
|
protected ?URI $homepage = null;
|
|
|
|
|
|
|
|
protected ?string $license = null;
|
|
|
|
|
|
|
|
protected bool $private = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var list<string>
|
|
|
|
*/
|
|
|
|
protected array $keywords = [];
|
|
|
|
|
2024-07-05 16:47:01 +00:00
|
|
|
protected ?string $minCastopodVersion = null;
|
|
|
|
|
2024-05-06 16:00:47 +00:00
|
|
|
/**
|
|
|
|
* @var list<string>
|
|
|
|
*/
|
|
|
|
protected array $hooks = [];
|
|
|
|
|
|
|
|
protected ?Settings $settings = null;
|
2024-05-09 17:55:41 +00:00
|
|
|
|
|
|
|
protected ?Repository $repository = null;
|
2024-05-06 16:00:47 +00:00
|
|
|
}
|