content = $content; } public function getContent(): mixed { return $this->content; } public function bencodeSerialise(): mixed { return $this->content; } public function encode(): string { return Serialiser::bencode()->serialise($this->content); } public function __toString(): string { return $this->encode(); } public static function fromEncoded(Stream|string $encoded): BencodedContent { return new BencodedContent(Serialiser::bencode()->deserialise($encoded)); } public static function fromFile(string $path): BencodedContent { return self::fromEncoded(FileStream::openRead($path)); } public static function fromRequest(): BencodedContent { return self::fromFile('php://input'); } }