You are here

public function ImageStyleTest::fileUriTarget in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/image/tests/src/Unit/ImageStyleTest.php \Drupal\Tests\image\Unit\ImageStyleTest::fileUriTarget()

Mock function for ImageStyle::fileUriTarget().

File

core/modules/image/tests/src/Unit/ImageStyleTest.php, line 226
Contains \Drupal\Tests\image\Unit\ImageStyleTest.

Class

ImageStyleTest
@coversDefaultClass \Drupal\image\Entity\ImageStyle

Namespace

Drupal\Tests\image\Unit

Code

public function fileUriTarget($uri) {

  // Remove the scheme from the URI and remove erroneous leading or trailing,
  // forward-slashes and backslashes.
  $target = trim(preg_replace('/^[\\w\\-]+:\\/\\/|^data:/', '', $uri), '\\/');

  // If nothing was replaced, the URI doesn't have a valid scheme.
  return $target !== $uri ? $target : FALSE;
}