1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-01 01:51:43 +02:00

Rename ImageInterface::toMediaType()

This commit is contained in:
Oliver Vogel
2023-12-21 15:33:08 +01:00
parent 27833d225c
commit c6d52c39d1
4 changed files with 9 additions and 9 deletions

View File

@@ -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));
}

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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);
}