main/app/API/Utils/ArrayUtils.php
public static function set(array &$object, $keys, $value)
    {
        $keys = explode('.', $keys);
        $depth = count($keys);
        $key = array_shift($keys);

        if (1 === $depth) {
            $object[$key] = $value;
        } else {
            if (!isset($object[$key])) {
                $object[$key] = [];
            } elseif (!is_array($object[$key])) {
                throw new \Exception('Cannot set property because it already exists as a non \stdClass');
            }

            static::set($object[$key], implode('.', $keys), $value);
        }
    }
public static function set(array &$object, $keys, $value)
    {
        $keys = explode('.', $keys);
        $depth = count($keys);
        $key = array_shift($keys);

        if (1 === $depth) {
            $object[$key] = $value;
        } else {
            if (!isset($object[$key])) {
                $object[$key] = [];
            } elseif (!is_array($object[$key])) {
                throw new \Exception('Cannot set property because it already exists as a non \stdClass');
            }

            static::set($object[$key], implode('.', $keys), $value);
        }
    }
public static function set ( array & $ object , $ keys , $ value ) { $ keys = explode ( '.' , $ keys ) ; $ depth = count ( $ keys ) ; $ key = array_shift ( $ keys ) ; if ( 1 === $ depth ) { $ object [ $ key ] = $ value ; } else { if ( ! isset ( $ object [ $ key ] ) ) { $ object [ $ key ] = [ ] ; } elseif ( ! is_array ( $ object [ $ key ] ) ) { throw new \ Exception ( 'Cannot set property because it already exists as a non \stdClass' ) ; } static :: set ( $ object [ $ key ] , implode ( '.' , $ keys ) , $ value ) ; } }
This is more or less the equivalent of lodash set for array.

@param array  $object
@param string $keys   - the property path
@param $value

@throws \Exception
This is more or less the equivalent of lodash set for array .