width = $width; $this->height = $height; $this->objectFit = $objectFit; $this->objectPosition = $objectPosition; } /** * @param array{width: string, height: string, objectFit: string, objectPosition: string} $attributes */ public static function from( array $attributes ): self { return new self( $attributes['width'], $attributes['height'], $attributes['objectFit'], $attributes['objectPosition'] ); } /** * @return array{width: string, height: string, objectFit: string, objectPosition: string} */ public function toArray(): array { return [ 'width' => $this->width, 'height' => $this->height, 'objectFit' => $this->objectFit, 'objectPosition' => $this->objectPosition, ]; } }