source = $source; } /** * Encode current source * * @throws EncoderException * @return string */ public function encode(): string { if (!$this->source->hasBlocks()) { throw new EncoderException("No data blocks in ImageData."); } return implode('', [ pack('C', $this->source->getLzwMinCodeSize()), implode('', array_map( fn(DataSubBlock $block): string => $block->encode(), $this->source->getBlocks(), )), AbstractEntity::TERMINATOR, ]); } }