Flow\JSONPath\AccessHelper::setValue PHP Method

setValue() public static method

public static setValue ( &$collection, $key, $value )
    public static function setValue(&$collection, $key, $value)
    {
        if (is_object($collection) && !$collection instanceof \ArrayAccess) {
            return $collection->{$key} = $value;
        } else {
            return $collection[$key] = $value;
        }
    }

Usage Example

Beispiel #1
0
 public function offsetSet($offset, $value)
 {
     if ($offset === null) {
         $this->data[] = $value;
     } else {
         AccessHelper::setValue($this->data, $offset, $value);
     }
 }