src/Util/CurveArray.php
public static function objectify(array $data)
    {
        if (self::isAssoc($data)) {
            $result = new \stdClass();
            foreach ($data as $key => $value) {
                $result->{$key} = is_array($value) ? self::objectify($value) : $value;
            }

            return $result;
        } else {
            $result = [];
            foreach ($data as $value) {
                $result[] = is_array($value) ? self::objectify($value) : $value;
            }

            return $result;
        }
    }
public static function objectify(array $data)
    {
        if (self::isAssoc($data)) {
            $result = new \stdClass();
            foreach ($data as $key => $value) {
                $result->{$key} = is_array($value) ? self::objectify($value) : $value;
            }

            return $result;
        } else {
            $result = [];
            foreach ($data as $value) {
                $result[] = is_array($value) ? self::objectify($value) : $value;
            }

            return $result;
        }
    }
Replaces all associative arrays with stdClass in an arbitrary array
structure

@param array $data
@return \stdClass|array