*/ final class VariationResponseData implements Response { /** * @use ArrayAccessible */ use ArrayAccessible; private function __construct( public readonly string $url = '', public readonly string $b64_json = '', ) { } /** * Acts as static factory, and returns a new Response instance. * * @param array{url?: string, b64_json?: string} $attributes */ public static function from(array $attributes): self { return new self( $attributes['url'] ?? '', $attributes['b64_json'] ?? '', ); } /** * {@inheritDoc} */ public function toArray(): array { return $this->url !== '' && $this->url !== '0' ? ['url' => $this->url] : ['b64_json' => $this->b64_json]; } }