You are here

trait InterlaceTrait in Image Effects 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/ImageToolkit/Operation/InterlaceTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\InterlaceTrait
  2. 8 src/Plugin/ImageToolkit/Operation/InterlaceTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\InterlaceTrait

Base trait for image_effects Interlace operations.

Hierarchy

  • trait \Drupal\image_effects\Plugin\ImageToolkit\Operation\InterlaceTrait
2 files declare their use of InterlaceTrait
Interlace.php in src/Plugin/ImageToolkit/Operation/gd/Interlace.php
Interlace.php in src/Plugin/ImageToolkit/Operation/imagemagick/Interlace.php

File

src/Plugin/ImageToolkit/Operation/InterlaceTrait.php, line 8

Namespace

Drupal\image_effects\Plugin\ImageToolkit\Operation
View source
trait InterlaceTrait {

  /**
   * {@inheritdoc}
   */
  protected function arguments() {
    return [
      'type' => [
        'description' => 'The interlace type.',
        'required' => FALSE,
        'default' => 'Plane',
      ],
    ];
  }

  /**
   * {@inheritdoc}
   */
  protected function validateArguments(array $arguments) {

    // Assure interlace type is valid.
    if (!$arguments['type'] || !in_array($arguments['type'], [
      'Line',
      'Plane',
    ])) {
      throw new \InvalidArgumentException("Invalid type '{$arguments['type']}' specified for the image 'interlace' operation");
    }
    return $arguments;
  }

}

Members