converter = $converter ?: new CommonMarkConverter(); $this->legacySupport = !method_exists($this->converter, 'convert'); } public function convert(string $body): string { if ($this->legacySupport) { return $this->converter->convertToHtml($body); } return $this->converter->convert($body); } }