You are here

public function TestToolkit::setType in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php \Drupal\image_test\Plugin\ImageToolkit\TestToolkit::setType()
  2. 9 core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php \Drupal\image_test\Plugin\ImageToolkit\TestToolkit::setType()

Sets the PHP type of the image.

Parameters

int $type: The image type represented by a PHP IMAGETYPE_* constant (e.g. IMAGETYPE_JPEG).

Return value

$this

1 call to TestToolkit::setType()
TestToolkit::parseFile in core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php
Determines if a file contains a valid image.

File

core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php, line 213

Class

TestToolkit
Defines a Test toolkit for image manipulation within Drupal.

Namespace

Drupal\image_test\Plugin\ImageToolkit

Code

public function setType($type) {
  if (in_array($type, static::supportedTypes())) {
    $this->type = $type;
  }
  return $this;
}