|null */ protected ?array $sizes; /** * Optional specifier for the theme this icon is designed for. `light` indicates * the icon is designed to be used with a light background, and `dark` indicates * the icon is designed to be used with a dark background. * * If not provided, the client should assume the icon can be used with any theme. * * @since 2025-11-25 * * @var 'light'|'dark'|null */ protected ?string $theme; /** * @param string $src @since 2025-11-25 * @param string|null $mimeType @since 2025-11-25 * @param array|null $sizes @since 2025-11-25 * @param 'light'|'dark'|null $theme @since 2025-11-25 */ public function __construct( string $src, ?string $mimeType = null, ?array $sizes = null, ?string $theme = null ) { $this->src = $src; $this->mimeType = $mimeType; $this->sizes = $sizes; $this->theme = $theme; } /** * Creates an instance from an array. * * @param array{ * src: string, * mimeType?: string|null, * sizes?: array|null, * theme?: 'light'|'dark'|null * } $data * @phpstan-param array $data * @return self */ public static function fromArray(array $data): self { self::assertRequired($data, ['src']); /** @var 'light'|'dark'|null $theme */ $theme = isset($data['theme']) ? self::asStringOrNull($data['theme']) : null; return new self( self::asString($data['src']), self::asStringOrNull($data['mimeType'] ?? null), self::asStringArrayOrNull($data['sizes'] ?? null), $theme ); } /** * Converts the instance to an array. * * @return array */ public function toArray(): array { $result = []; $result['src'] = $this->src; if ($this->mimeType !== null) { $result['mimeType'] = $this->mimeType; } if ($this->sizes !== null) { $result['sizes'] = $this->sizes; } if ($this->theme !== null) { $result['theme'] = $this->theme; } return $result; } /** * @return string */ public function getSrc(): string { return $this->src; } /** * @return string|null */ public function getMimeType(): ?string { return $this->mimeType; } /** * @return array|null */ public function getSizes(): ?array { return $this->sizes; } /** * @return 'light'|'dark'|null */ public function getTheme(): ?string { return $this->theme; } }