encoder()->encode(); } /** * Get encoder object for current entity. * * @throws EncoderException */ protected function encoder(): AbstractEncoder { $classname = sprintf('Intervention\Gif\Encoders\%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; } }