/** * Set value by key * * @param int|string $key * @param mixed $value * * @throws \InvalidArgumentException * @return $this */ public function set($key, $value = null) { $this->check(); if (!Arrays::isArray($key)) { $key = array($key => $value); } foreach ($key as $k => $v) { Arrays::setPath($this->data, $k, $v); } $this->encode(); return $this; }