*/
public function set($offset, $value)
{
- $offset = square_brackets_to_dots($offset);
+ $offset = self::square_brackets_to_dots($offset);
Arr::set($this->_data, $this->_offset($offset), $this->_fixValue($value));
}
+ protected static function square_brackets_to_dots($string)
+ {
+ $string = str_replace(['[', ']'], ['.', ''], $string);
+
+ return $string;
+ }
+
protected function _fixValue($value)
{
if (!is_array($value)) {
$dot = Arr::dot($value);
$res = [];
foreach ($dot as $k => $v) {
- Arr::set($res, $this->_offset(square_brackets_to_dots($k)), $v);
+ Arr::set($res, $this->_offset(self::square_brackets_to_dots($k)), $v);
}
return $res;
}