/** * Sets contents encoding. * If none is set, assume no encoding is used. * * @param string $encoding Encoding name * @return \Jyxo\Mail\Email\Attachment\StringAttachment * @throws \InvalidArgumentException If an incompatible encoding was provided */ public function setEncoding(string $encoding) : self { if (!empty($encoding) && !\Jyxo\Mail\Encoding::isCompatible($encoding)) { throw new \InvalidArgumentException(sprintf('Incompatible encoding %s', $encoding)); } $this->encoding = $encoding; return $this; }