Файл: vendor/intervention/gif/src/Traits/CanEncode.php
Строк: 69
<?php
declare(strict_types=1);
namespace InterventionGifTraits;
use InterventionGifEncodersAbstractEncoder;
use InterventionGifExceptionsEncoderException;
trait CanEncode
{
/**
* Encode current entity.
*
* @throws EncoderException
*/
public function encode(): string
{
return $this->encoder()->encode();
}
/**
* Get encoder object for current entity.
*
* @throws EncoderException
*/
protected function encoder(): AbstractEncoder
{
$classname = sprintf('InterventionGifEncoders%sEncoder', self::shortClassname());
if (!class_exists($classname)) {
throw new EncoderException('Encoder for "' . $this::class . '" not found');
}
$encoder = new $classname($this);
if (!($encoder instanceof AbstractEncoder)) {
throw new EncoderException('Encoder for "' . $this::class . '" not found');
}
return $encoder;
}
}