public static function arrayize($value)
    {
        $forbidden = [];
        if ($value instanceof Model) {
            $forbidden = $value->getHidden();
        }

        $array = [];
        foreach ($value as $key => $item) {
            if (!in_array(trim($key), $forbidden)) {
                switch (gettype($item)) {
                    case 'object':
                    case 'array':
                        $buffer = self::arrayize($item);
                        if (!empty($buffer)) {
                            $array[trim($key)] = $buffer;
                        }

                        break;
                    default:
                        if (isset($item)) {
                            $array[trim($key)] = $item;
                        }
                }
            }
        }

        return $array;
    }
public static function arrayize($value)
    {
        $forbidden = [];
        if ($value instanceof Model) {
            $forbidden = $value->getHidden();
        }

        $array = [];
        foreach ($value as $key => $item) {
            if (!in_array(trim($key), $forbidden)) {
                switch (gettype($item)) {
                    case 'object':
                    case 'array':
                        $buffer = self::arrayize($item);
                        if (!empty($buffer)) {
                            $array[trim($key)] = $buffer;
                        }

                        break;
                    default:
                        if (isset($item)) {
                            $array[trim($key)] = $item;
                        }
                }
            }
        }

        return $array;
    }
public static function arrayize ( $ value ) { $ forbidden = [ ] ; if ( $ value instanceof Model ) { $ forbidden = $ value -> getHidden ( ) ; } $ array = [ ] ; foreach ( $ value as $ key => $ item ) { if ( ! in_array ( trim ( $ key ) , $ forbidden ) ) { switch ( gettype ( $ item ) ) { case 'object' : case 'array' : $ buffer = self :: arrayize ( $ item ) ; if ( ! empty ( $ buffer ) ) { $ array [ trim ( $ key ) ] = $ buffer ; } break ; default : if ( isset ( $ item ) ) { $ array [ trim ( $ key ) ] = $ item ; } } } } return $ array ; }
Transform the given structure into array
@param mixed $value
@return array
Transform the given structure into array