public function setParam($key, $value = null)
    {
        if (!$this->hasParam($key)) {
            throw new \InvalidArgumentException(sprintf('Cannot set %s as parameter cause this key does not exist.', $key));
        }

        if (is_object($value)) {
            throw new \InvalidArgumentException('Parameter\'s value cannot be type of object.');
        }

        $currentValue = $this->getParamValue($key);
        if (
            (null !== $value && null !== $currentValue)
            && (
                gettype($value) !== gettype($currentValue)
                && (
                    !(is_string($value) || is_integer($value))
                    || !(is_string($currentValue) || is_integer($currentValue))
                )
            )
        ) {
            throw new \InvalidArgumentException(sprintf(
                'Cannot replace %s\'s value, %s expected and %s given.',
                $key,
                gettype($currentValue),
                gettype($value)
            ));
        }

        if (null === $value) {
            unset($this->_parameters[$key]);
        } else {
            $this->_parameters[$key] = ['value' => $value];
        }

        return $this->getContentInstance();
    }
public function setParam($key, $value = null)
    {
        if (!$this->hasParam($key)) {
            throw new \InvalidArgumentException(sprintf('Cannot set %s as parameter cause this key does not exist.', $key));
        }

        if (is_object($value)) {
            throw new \InvalidArgumentException('Parameter\'s value cannot be type of object.');
        }

        $currentValue = $this->getParamValue($key);
        if (
            (null !== $value && null !== $currentValue)
            && (
                gettype($value) !== gettype($currentValue)
                && (
                    !(is_string($value) || is_integer($value))
                    || !(is_string($currentValue) || is_integer($currentValue))
                )
            )
        ) {
            throw new \InvalidArgumentException(sprintf(
                'Cannot replace %s\'s value, %s expected and %s given.',
                $key,
                gettype($currentValue),
                gettype($value)
            ));
        }

        if (null === $value) {
            unset($this->_parameters[$key]);
        } else {
            $this->_parameters[$key] = ['value' => $value];
        }

        return $this->getContentInstance();
    }
public function setParam ( $ key , $ value = null ) { if ( ! $ this -> hasParam ( $ key ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Cannot set %s as parameter cause this key does not exist.' , $ key ) ) ; } if ( is_object ( $ value ) ) { throw new \ InvalidArgumentException ( 'Parameter\'s value cannot be type of object.' ) ; } $ currentValue = $ this -> getParamValue ( $ key ) ; if ( ( null !== $ value && null !== $ currentValue ) && ( gettype ( $ value ) !== gettype ( $ currentValue ) && ( ! ( is_string ( $ value ) || is_integer ( $ value ) ) || ! ( is_string ( $ currentValue ) || is_integer ( $ currentValue ) ) ) ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Cannot replace %s\'s value, %s expected and %s given.' , $ key , gettype ( $ currentValue ) , gettype ( $ value ) ) ) ; } if ( null === $ value ) { unset ( $ this -> _parameters [ $ key ] ) ; } else { $ this -> _parameters [ $ key ] = [ 'value' => $ value ] ; } return $ this -> getContentInstance ( ) ; }
Sets one parameter.

@param string $key   the parameter name to set
@param mixed  $value the parameter value, if null is passed it will unset provided key parameter

@return AbstractContent The current instance
Sets one parameter .