Пример #1
0
 /**
  * @param string $key
  * @param array|string $path
  * @param mixed $value
  * @param boolean $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");
     }
     Type\Complex::setIn($target, $path, $value, $push);
     $this->change($key, $target);
     return $this;
 }
Пример #2
0
 public function testSetInException()
 {
     $target = ['a' => ['b' => 1]];
     $this->setExpectedException('\\RuntimeException');
     Complex::setIn($target, ['a', 'b', 'c'], 2);
 }