diff --git a/src/Drivers/AbstractDecoder.php b/src/Drivers/AbstractDecoder.php index c3dc633e..b8e4a195 100644 --- a/src/Drivers/AbstractDecoder.php +++ b/src/Drivers/AbstractDecoder.php @@ -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(); diff --git a/src/Drivers/Gd/Decoders/BinaryImageDecoder.php b/src/Drivers/Gd/Decoders/BinaryImageDecoder.php index ad1b14f4..00500b18 100644 --- a/src/Drivers/Gd/Decoders/BinaryImageDecoder.php +++ b/src/Drivers/Gd/Decoders/BinaryImageDecoder.php @@ -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 diff --git a/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php b/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php index 42356a60..1887ccd1 100644 --- a/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php +++ b/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php @@ -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;