public function testArraySetInException() { $target = ['a' => ['b' => 1]]; $this->setExpectedException('\\RuntimeException'); \Owl\array_set_in($target, ['a', 'b', 'c'], 2); }
/** * @param string $key * @param array|string $path * @param mixed $value * @param bool $push * * @return $this */ public function setIn($key, $path, $value, $push = false) { $this->prepareSet($key); $target = $this->get($key); $path = (array) $path; if (!is_array($target)) { throw new Exception\UnexpectedPropertyValueException(get_class($this) . ": Property {$key} is not complex type"); } \Owl\array_set_in($target, $path, $value, $push); $this->change($key, $target); return $this; }