-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement EncodedImageObjectDecoder::class
- Loading branch information
1 parent
ce4d2bc
commit 71540fd
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Intervention\Image\Decoders; | ||
|
||
use Intervention\Image\Drivers\SpecializableDecoder; | ||
|
||
class EncodedImageObjectDecoder extends SpecializableDecoder | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Intervention\Image\Drivers\Gd\Decoders; | ||
|
||
use Intervention\Image\EncodedImage; | ||
use Intervention\Image\Exceptions\DecoderException; | ||
use Intervention\Image\Interfaces\ImageInterface; | ||
use Intervention\Image\Interfaces\ColorInterface; | ||
|
||
class EncodedImageObjectDecoder extends BinaryImageDecoder | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
* | ||
* @see DecoderInterface::decode() | ||
*/ | ||
public function decode(mixed $input): ImageInterface|ColorInterface | ||
{ | ||
if (!is_a($input, EncodedImage::class)) { | ||
throw new DecoderException('Unable to decode input'); | ||
} | ||
|
||
return parent::decode($input->toString()); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Drivers/Imagick/Decoders/EncodedImageObjectDecoder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Intervention\Image\Drivers\Imagick\Decoders; | ||
|
||
use Intervention\Image\EncodedImage; | ||
use Intervention\Image\Exceptions\DecoderException; | ||
use Intervention\Image\Interfaces\ImageInterface; | ||
use Intervention\Image\Interfaces\ColorInterface; | ||
|
||
class EncodedImageObjectDecoder extends BinaryImageDecoder | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
* | ||
* @see DecoderInterface::decode() | ||
*/ | ||
public function decode(mixed $input): ImageInterface|ColorInterface | ||
{ | ||
if (!is_a($input, EncodedImage::class)) { | ||
throw new DecoderException('Unable to decode input'); | ||
} | ||
|
||
return parent::decode($input->toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters