private function encodeValue($value, $depth, array $options, callable $encode)
    {
        foreach ($this->encoders as $encoder) {
            if ($encoder->supports($value)) {
                return $encoder->encode($value, $depth, $options, $encode);
            }
        }

        throw new \InvalidArgumentException(sprintf("Unsupported value type '%s'", \gettype($value)));
    }