protected static function joinParam( $param = [], $join = '=', $glue = '&', $useKey = true){



        $allParam = [];

        foreach ($param as $key => $val)
        {
            if( is_array( $val ) ){
                if ($useKey && isset($val[0]) && is_array($val[0]) === false) {
                    $newValue = [];
                    foreach ($val as $element) {
                        $newValue[] = $key . $join . self::replaceCharacters($element);
                    }

                    return implode($glue, $newValue);
                } else {
                    $val = self::joinParam( $val, $join, $glue, $useKey);
                }
            }

            // ommit parameters with empty values
            if( !empty( $val )){
                #self::$urlParam[] = $useKey
                $allParam[] = $useKey
                        ? $key . $join .urlencode(URLify::downcode($val))
                        : $join .urlencode(URLify::downcode($val));
            }
        }

        // no parameters given
        if( is_null( $allParam ) ) {
            return '';
        }

        $allParam = self::replaceCharacters($allParam);

        return implode($glue, $allParam );
    }