You are here

protected function SetGifTransparentColorTrait::validateArguments in Image Effects 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/ImageToolkit/Operation/SetGifTransparentColorTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\SetGifTransparentColorTrait::validateArguments()
  2. 8 src/Plugin/ImageToolkit/Operation/SetGifTransparentColorTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\SetGifTransparentColorTrait::validateArguments()

File

src/Plugin/ImageToolkit/Operation/SetGifTransparentColorTrait.php, line 28

Class

SetGifTransparentColorTrait
Base trait for set_gif_transparent_color image operations.

Namespace

Drupal\image_effects\Plugin\ImageToolkit\Operation

Code

protected function validateArguments(array $arguments) {

  // Assure transparent color is a valid hex string.
  if ($arguments['transparent_color'] && !Color::validateHex($arguments['transparent_color'])) {
    $transparent_color = $arguments['transparent_color'];
    throw new \InvalidArgumentException("Invalid transparent color ({$transparent_color}) specified for the image 'set_gif_transparent_color' operation");
  }
  return $arguments;
}