Add a piece of shared data to the environment.

@param  array|string  $key
@param  mixed  $value
@return mixed
774449
public function share($key, $value = null)
    {
        $keys = is_array($key) ? $key : [$key => $value];

        foreach ($keys as $key => $value) {
            $this->shared[$key] = $value;
        }

        return $value;
    }
1030158
public function addData($key, $value) {
    if (!isset($this->data)) $this->data = array();
    $this->data[$key] = $value;
    return $this;
  }
906035
public function with($key, $value = null)
    {
        if (is_array($key)) {
            $this->_data = array_merge($this->_data, $key);
        } else {
            $this->_data[$key] = $value;
        }

        return $this;
    }
974531
public function set($key, $value = null)
    {
        if ($key === null) {
            array_push($this->storage, $value);

            return $this;
        }

        if (is_array($key)) {
            foreach ($key as $key => $value) {
                $this->storage[$key] = $value;
            }

            return $this;
        }

        $this->setValueToStack($this->storage, explode(self::SEPARATOR, $key), $value);

        return $this;
    }
1296344
public function setData($key, $value = null)
    {
        if (is_array($key)) {
            foreach ($key as $key => $value) {
                if (!is_array($value) && !is_object($value)) {
                    $value = $this->stripInvalidUnicodeSequences(
                        $this->stringToUtf8(
                            $value,
                            ShopgateObject::$sourceEncodings
                        )
                    );
                }
                $this->$key = $value;
            }
        } else {
            if (!is_array($value) && !is_object($value)) {
                if (!is_null($value)) {
                    $value = $this->stripInvalidUnicodeSequences(
                        $this->stringToUtf8(
                            $value,
                            ShopgateObject::$sourceEncodings
                        )
                    );
                }
            }
            $this->$key = $value;
        }

        return $this;
    }
635954
public function shareData($key, $value= null)
    {
        if (is_array($key)) {
            foreach  ($key as $variableName => $variableValue) {
                $this->templateRenderer->setData($variableName, $variableValue);
            }
            return $this;
        }

        $this->templateRenderer->setData($key, $value);
        return $this;
    }
1365503
public function set($key, $value = null)
    {
        if (is_array($key))
        {
            foreach ($key as $name => $value)
            {
                $this->_data[$name] = $value;
            }
        }
        else
        {
            $this->_data[$key] = $value;
        }

        return $this;
    }
701849
public function add ($key , $value) {
        if (!$this->beforeAdd()) {
            return false;
        }
        if (!$this->getConnection ()->getClient ()->zadd ($this->name , $value , $key)) {
            return false;
        }
        $this->_data = null;
        $this->_count = null;
        $this->afterAdd();
        return true;
    }
223245
public function addProperty(string $key, string $value) : DataSet
    {
        $this->properties[$key] = $value;

        return $this;
    }
622608
protected function addDataByScenario($value, $key) {
        switch ($this->scenario) {
            case static::SCENARIO_OVERWRITE:
                $this->shared[$key] = $value;
                break;
            case static::SCENARIO_WRITE_ONCE:
                if (!isset($this->shared[$key])) {
                    $this->shared[$key] = $value;
                }
                break;
            case static::SCENARIO_MERGE:
                $this->mergeDataEntry($value, $key);
                break;
        }
        return $this;
    }
694330
public function add($key, $value){
        if( $this->exists($key) ){
            throw new Exception("Item already exists in storage ($key)  ($this->name)");
        }
        $this->storage[$key] = $value;
        return $this->storage[$key];

    }
1145444
public function put($key, $value)
    {
        return $this->session->put($this->getSessionKey($key), $value);
    }
348415
public function addAdditionalData(string $key, $value): self
    {
        $this->additionalData[$key] = $value;

        return $this;
    }
1372540
public function set($key, $value = null)
    {
        if (is_array($key)) {
            $this->global_data = array_merge($this->global_data, $key);
        } else {
            $this->global_data[$key] = $value;
        }

        return $this;
    }
548230
public function set($key, $value)
    {
        $config = $this->data;
        if (!$key) {
            $config = array_merge($config, $value);
        }
        $key = is_array($key) ? $key : [$key];

        $data = &$config;
        while ($key) {
            $k = array_shift($key);
            $config[$k] = isset($config[$k]) ? $config[$k] : [];
            $config[$k] = $key
                ? $config[$k]
                : (is_array($value)
                    ? array_merge($config[$k], $value)
                    : $value);
            $config = &$config[$k];
        }
        $this->data = $data;
        return $this->save();
    }
1081731
public static function set(string $key, $value)
    {
        file_put_contents(self::determineDabaseFilePathFor($key), Json::encode($value));

        return $value;
    }
132641
public static function addSharedToArgs($arguments = [], $value, $key = null) {
        /** @var SharedDataInterface $instance */
        if (($instance = static::instanceFromArguments($arguments)) === null) {
            return null;
        }
        return $instance->addData($value, $key);
    }