public function setEncoder(callable $encoder): Yaml
    {
        if (!is_callable($encoder)) {
            throw new \InvalidArgumentException('The provided encoder must be callable.');
        }

        $this->encoder = $encoder;

        return $this;
    }