1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-30 17:19:50 +02:00

Rename method & add docblocks

This commit is contained in:
Oliver Vogel
2023-12-03 19:44:32 +01:00
parent 9e369e1d57
commit 0e5328a575
3 changed files with 21 additions and 3 deletions

View File

@@ -20,6 +20,13 @@ abstract class AbstractDecoder implements DecoderInterface
//
}
/**
* Try to decode given input to image or color object
*
* @param mixed $input
* @return ImageInterface|ColorInterface
* @throws DecoderException
*/
final public function handle($input): ImageInterface|ColorInterface
{
try {
@@ -35,6 +42,11 @@ abstract class AbstractDecoder implements DecoderInterface
return $decoded;
}
/**
* Determine if current decoder has a successor
*
* @return bool
*/
protected function hasSuccessor(): bool
{
return $this->successor !== null;
@@ -55,7 +67,13 @@ abstract class AbstractDecoder implements DecoderInterface
return $type;
}
protected function decodeExifData(string $image_data): CollectionInterface
/**
* Extract and return EXIF data from given image data string
*
* @param string $image_data
* @return CollectionInterface
*/
protected function extractExifData(string $image_data): CollectionInterface
{
if (!function_exists('exif_read_data')) {
return new Collection();

View File

@@ -30,7 +30,7 @@ class BinaryImageDecoder extends AbstractDecoder implements DecoderInterface
$image = new Image(
new Driver(),
$this->coreFromString($input),
$this->decodeExifData($input)
$this->extractExifData($input)
);
// fix image orientation

View File

@@ -51,7 +51,7 @@ class BinaryImageDecoder extends AbstractDecoder implements DecoderInterface
$image = new Image(
new Driver(),
new Core($imagick),
$this->decodeExifData($input)
$this->extractExifData($input)
);
return $image;