src/SetDataCapableTrait.php
protected function _setData($key, $value)
    {
        $store = $this->_getDataStore();
        try {
            $this->_containerSet($store, $key, $value);
        } catch (InvalidArgumentException $e) {
            throw $this->_createOutOfRangeException($this->__('Invalid store'), null, $e, $store);
        } catch (OutOfRangeException $e) {
            throw $this->_createInvalidArgumentException($this->__('Invalid key'), null, $e, $store);
        }
    }
protected function _setData($key, $value)
    {
        $store = $this->_getDataStore();
        try {
            $this->_containerSet($store, $key, $value);
        } catch (InvalidArgumentException $e) {
            throw $this->_createOutOfRangeException($this->__('Invalid store'), null, $e, $store);
        } catch (OutOfRangeException $e) {
            throw $this->_createInvalidArgumentException($this->__('Invalid key'), null, $e, $store);
        }
    }
Assign a single piece of data.

@since [*next-version*]

@param string|int|float|bool|Stringable $key   The key, for which to assign the data.
Unless an integer is given, this will be normalized to string.
@param mixed                            $value The value to assign.

@throws InvalidArgumentException    If key is invalid.
@throws OutOfRangeException         If internal data store is invalid.
@throws ContainerExceptionInterface If error occurs while writing to container.