|null $views the view names the theme overrides, when the preset could read them */ public function __construct(public ?string $core = null, public ?string $sdk = null, public ?array $views = null) {} public static function of(ExtensionManifest $theme): self { $path = $theme->path(...explode('/', ThemeDefinition::BUILD_INFO)); $data = is_file($path) ? rescue(fn (): mixed => json_decode(File::get($path), true, 8, JSON_THROW_ON_ERROR), report: false) : null; if (! is_array($data)) { return new self; } return new self( core: is_string($data['core'] ?? null) ? $data['core'] : null, sdk: is_string($data['sdk'] ?? null) ? $data['sdk'] : null, views: is_array($data['views'] ?? null) ? array_values(array_filter($data['views'], is_string(...))) : null, ); } }