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++;
    }
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++;
    }
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 ++ ; }
Add a value to the collection

@param string $key The key to add the value under
@param string|\sndsgd\http\UploadedFile $value The value to add
Add a value to the collection