Set a key/value pair in the data array.

@param string|int $key
@param mixed $value

@return self
488761
public function addData($key, $value)
    {
        if (!is_string($key) && !is_int($key)) {
            throw new \InvalidArgumentException('Data keys must be of type "string" or "integer".');
        }

        $data = $this->getData();

        $data[$key] = $value;

        return $this->setData($data);
    }
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;
    }
429846
public function set($key, $value = null)
    {
        if( is_array($key) ) {
            $this->values($key);
        } else {
            $this->value($key, $value);
        }
        return $this;
    }
490166
function set($key, $value) {
        parent::set($key, $value);
        if($this !== $this->client->channels) {
            $this->client->channels->set($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;
    }
753049
public function set($key, $value = null){
        if(is_array($key)){
            $this->_dirty = $key;
        }
        else{
            $this->_dirty[$key] = $value;
        }
        
        return $this;
    }
171030
public function set($key, $value)
    {
        DotArray::set($this->getStorage(), $key,$value);

        return $this;
    }
301157
function set($key, $value)
    {
        \Poirot\Storage\assertKey($key);

        $this->data[$key] = $value;
        return $this;
    }
383269
public function set($key, $value)
    {
        $cont = clone $this;
        $cont->setParameter($key, $value);

        return $cont;
    }
340608
public function set($key, $value)
    {
        $key = $this->normalizeKey($key);

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

        return $this;
    }
356970
public function set($keys, $value) {
    if (is_string($keys)) $keys = explode('.',$keys);
    if (is_integer($keys)) $keys = array($keys);
    
    return $this->setDataWithKeys($keys, $value);
  }
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;
    }
1185226
public function offsetSet($key, $value)
    {
        if (is_null($key)) {
            $this->values[] = $value;
        } else {
            $this->values[$key] = $value;
        }

        return $this;
    }
186944
public function set(string $key, $value)
  {
    $keys = \explode('.',$key);
    $arr = &$this->confValues;
    $arrParent = null;

    # Walk the structure
    foreach ($keys as $key) {
      $arrParent = &$arr;
      $lastKey = $key;
      if (!isset($arr[$key])) {
        $arr[$key]=[];
      }
      $arr = &$arr[$key];
    }

    if (\is_null($value)) {
      unset($arrParent[$lastKey]); // delete the key
    } else {
      $arr = $value; // set the value in the original confArray
    }

    return $this;
  }
646878
public function set(string $key, $value): self
    {
        Arr::set($this->data, $key, $value, true);
        return $this;
    }
895963
public function setData($key, $value = null)
    {
        if (is_array($key)) {
            $this->_data = $key;
        } else {
            $this->_data[$key] = $value;
        }

        return $this;
    }
19913
public function set($key, $value)
    {
        $keys = explode('.', $key);

        $data = &$this->parameters;

        while (count($keys) > 1) {
            $pkey = $keys[0];

            if (!array_key_exists($pkey, $data) || !is_array($data[$pkey])) {
                $data[$pkey] = [];
            }

            $data = &$data[$pkey];
            array_shift($keys);
        }

        $data[$keys[0]] = $value;

        return $this;
    }