You are here

protected function MirrorTrait::validateArguments in Image Effects 8.3

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

File

src/Plugin/ImageToolkit/Operation/MirrorTrait.php, line 31

Class

MirrorTrait
Base trait for image_effects Mirror operations.

Namespace

Drupal\image_effects\Plugin\ImageToolkit\Operation

Code

protected function validateArguments(array $arguments) {

  // Ensure either horizontal flop or vertical flip is requested.
  $arguments['x_axis'] = (bool) $arguments['x_axis'];
  $arguments['y_axis'] = (bool) $arguments['y_axis'];
  if ($arguments['x_axis'] === FALSE && $arguments['y_axis'] === FALSE) {
    throw new \InvalidArgumentException("Neither horizontal flop nor vertical flip is specified for the image 'mirror' operation");
  }
  return $arguments;
}