src/Helpers/DataHelper.php
public static function toObject($array, $class = \stdClass::class)
    {
        $object = new $class;

        foreach ($array as $name => $value) {
            $name = trim($name);

            if (!$name || is_numeric($name)) {
                continue;
            }

            $object->$name = \is_array($value) ? self::toObject($value) : $value;
        }

        return $object;
    }
public static function toObject($array, $class = \stdClass::class)
    {
        $object = new $class;

        foreach ($array as $name => $value) {
            $name = trim($name);

            if (!$name || is_numeric($name)) {
                continue;
            }

            $object->$name = \is_array($value) ? self::toObject($value) : $value;
        }

        return $object;
    }
public static function toObject ( $ array , $ class = \ stdClass :: class ) { $ object = new $ class ; foreach ( $ array as $ name => $ value ) { $ name = trim ( $ name ) ; if ( ! $ name || is_numeric ( $ name ) ) { continue ; } $ object -> $ name = \ is_array ( $ value ) ? self :: toObject ( $ value ) : $ value ; } return $ object ; }
data to array
@param array|\Traversable $array
@param string $class
@return mixed
data to array