CodeExplorer generateContentId example
if (!
str_contains($cid, '@'
)) { throw new InvalidArgumentException(sprintf('Invalid cid "%s".',
$cid));
} $this->cid =
$cid;
return $this;
} public function getContentId(): string
{ return $this->cid ?:
$this->cid =
$this->
generateContentId();
} public function hasContentId(): bool
{ return null !==
$this->cid;
} public function getMediaType(): string
{ return $this->mediaType;
} if (!
str_contains($cid, '@'
)) { throw new InvalidArgumentException(sprintf('Invalid cid "%s".',
$cid));
} $this->cid =
$cid;
return $this;
} public function getContentId(): string
{ return $this->cid ?:
$this->cid =
$this->
generateContentId();
} public function hasContentId(): bool
{ return null !==
$this->cid;
} public function getMediaType(): string
{ return $this->mediaType;
} private function generateContentId(): string
{ return bin2hex(random_bytes(16
)).'@symfony';
} private function prepareParts(AbstractPart ...
$parts): void
{ foreach ($parts as $part) { if (!
$part->
getHeaders()->
has('Content-ID'
)) { $part->
getHeaders()->
setHeaderBody('Id', 'Content-ID',
$this->
generateContentId());
} } }} private function generateContentId(): string
{ return bin2hex(random_bytes(16
)).'@symfony';
} private function prepareParts(AbstractPart ...
$parts): void
{ foreach ($parts as $part) { if (!
$part->
getHeaders()->
has('Content-ID'
)) { $part->
getHeaders()->
setHeaderBody('Id', 'Content-ID',
$this->
generateContentId());
} } }}