GaussianBlurTrait.php in Image Effects 8.2
File
src/Plugin/ImageToolkit/Operation/GaussianBlurTrait.php
View source
<?php
namespace Drupal\image_effects\Plugin\ImageToolkit\Operation;
trait GaussianBlurTrait {
protected function arguments() {
return [
'radius' => [
'description' => 'The blur radius, in pixels.',
],
'sigma' => [
'description' => 'The blur sigma value.',
'required' => FALSE,
'default' => NULL,
],
];
}
protected function validateArguments(array $arguments) {
if (!is_int($arguments['radius']) || $arguments['radius'] < 1) {
throw new \InvalidArgumentException("Invalid radius ('{$arguments['radius']}') specified for the image 'gaussian_blur' operation");
}
if ($arguments['sigma'] !== NULL && (!is_float($arguments['sigma']) || $arguments['sigma'] <= 0)) {
throw new \InvalidArgumentException("Invalid sigma value ('{$arguments['sigma']}') specified for the image 'gaussian_blur' operation");
}
return $arguments;
}
}