uri = $uri; return $this; } public function getUri(): ?string { return $this->uri; } /** * Ensures that the provided URI can be used safely in a srcset attribute */ public function getSanitizedUri(): ?string { if ($this->uri === null) { return null; } return strtr($this->uri, [ ' ' => '%20', ',' => '%2C', ]); } public function generateSrcset(): string { return $this->getSanitizedUri() . ' ' . $this->getDescriptor(); } public function __toString() { return $this->generateSrcset(); } }