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(function ($block) { return $block->encode(); }, $this->source->getBlocks())), AbstractEntity::TERMINATOR, ]); } }