public function addValue(string $key, $value)
    {
        # ensure the total input variables doesn't exceed `max_input_variables`
        if ($this->count === $this->maxVars) {
            throw new DecodeException("max_input_variables exceeded");
        }

        # if the key has both open and close brackets
        # and the close comes after the open, the key contains nesting
        if (
            ($openPos = strpos($key, "[")) !== false &&
            ($closePos = strpos($key, "]")) !== false &&
            $openPos < $closePos
        ) {
            $this->addNestedValue($key, $value, $openPos);
        } else {
            \sndsgd\Arr::addValue($this->values, $key, $value);
        }

        $this->count++;
    }