From c6d52c39d173466d4ddae970aab0c0302bcf8b02 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Thu, 21 Dec 2023 15:33:08 +0100 Subject: [PATCH] Rename ImageInterface::toMediaType() --- src/Image.php | 4 ++-- src/Interfaces/ImageInterface.php | 2 +- tests/Drivers/Gd/ImageTest.php | 6 +++--- tests/Drivers/Imagick/ImageTest.php | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Image.php b/src/Image.php index f2aded3e..18bd6582 100644 --- a/src/Image.php +++ b/src/Image.php @@ -748,9 +748,9 @@ final class Image implements ImageInterface, Countable /** * {@inheritdoc} * - * @see ImageInterface::toMediaType() + * @see ImageInterface::encodeByMediaType() */ - public function toMediaType(?string $type = null): EncodedImageInterface + public function encodeByMediaType(?string $type = null): EncodedImageInterface { return $this->encode(new MediaTypeEncoder($type)); } diff --git a/src/Interfaces/ImageInterface.php b/src/Interfaces/ImageInterface.php index a12b22b5..668fd757 100644 --- a/src/Interfaces/ImageInterface.php +++ b/src/Interfaces/ImageInterface.php @@ -564,7 +564,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param null|string $type * @return EncodedImageInterface */ - public function toMediaType(?string $type = null): EncodedImageInterface; + public function encodeByMediaType(?string $type = null): EncodedImageInterface; /** * Encode image to JPEG format diff --git a/tests/Drivers/Gd/ImageTest.php b/tests/Drivers/Gd/ImageTest.php index 9c9523c3..c49d4b23 100644 --- a/tests/Drivers/Gd/ImageTest.php +++ b/tests/Drivers/Gd/ImageTest.php @@ -122,13 +122,13 @@ class ImageTest extends TestCase $this->assertMediaType('image/gif', (string) $result); } - public function testToMediaType(): void + public function testEncodeByMediaType(): void { - $result = $this->readTestImage('blue.gif')->toMediaType(); + $result = $this->readTestImage('blue.gif')->encodeByMediaType(); $this->assertInstanceOf(EncodedImage::class, $result); $this->assertMediaType('image/gif', (string) $result); - $result = $this->readTestImage('blue.gif')->toMediaType('image/png'); + $result = $this->readTestImage('blue.gif')->encodeByMediaType('image/png'); $this->assertInstanceOf(EncodedImage::class, $result); $this->assertMediaType('image/png', (string) $result); } diff --git a/tests/Drivers/Imagick/ImageTest.php b/tests/Drivers/Imagick/ImageTest.php index 23d9b617..5623d857 100644 --- a/tests/Drivers/Imagick/ImageTest.php +++ b/tests/Drivers/Imagick/ImageTest.php @@ -121,13 +121,13 @@ class ImageTest extends TestCase $this->assertMediaType('image/gif', (string) $result); } - public function testToMediaType(): void + public function testEncodeByMediaType(): void { - $result = $this->readTestImage('blue.gif')->toMediaType(); + $result = $this->readTestImage('blue.gif')->encodeByMediaType(); $this->assertInstanceOf(EncodedImage::class, $result); $this->assertMediaType('image/gif', (string) $result); - $result = $this->readTestImage('blue.gif')->toMediaType('image/png'); + $result = $this->readTestImage('blue.gif')->encodeByMediaType('image/png'); $this->assertInstanceOf(EncodedImage::class, $result); $this->assertMediaType('image/png', (string) $result); }