public function urlSafeDecode(string $base64_url_safe, array $url_unsafe_chars = ['+', '/'], array $url_safe_chars = ['-', '_'], string $trim_padding_chars = '='): string
    {
        $string = isset($trim_padding_chars[0]) ? rtrim($base64_url_safe, $trim_padding_chars) : $base64_url_safe;
        $string = isset($trim_padding_chars[0]) ? str_pad($string, strlen($string) % 4, '=', STR_PAD_RIGHT) : $string;
        $string = str_replace($url_safe_chars, $url_unsafe_chars, $string);

        if (!is_string($string = base64_decode($string, true))) {
            throw $this->c::issue('Base64 decoding failure.');
        }
        return $string;
    }
public function urlSafeDecode(string $base64_url_safe, array $url_unsafe_chars = ['+', '/'], array $url_safe_chars = ['-', '_'], string $trim_padding_chars = '='): string
    {
        $string = isset($trim_padding_chars[0]) ? rtrim($base64_url_safe, $trim_padding_chars) : $base64_url_safe;
        $string = isset($trim_padding_chars[0]) ? str_pad($string, strlen($string) % 4, '=', STR_PAD_RIGHT) : $string;
        $string = str_replace($url_safe_chars, $url_unsafe_chars, $string);

        if (!is_string($string = base64_decode($string, true))) {
            throw $this->c::issue('Base64 decoding failure.');
        }
        return $string;
    }
public function urlSafeDecode ( string $ base64_url_safe , array $ url_unsafe_chars = [ '+' , '/' ] , array $ url_safe_chars = [ '-' , '_' ] , string $ trim_padding_chars = '=' ) : string { $ string = isset ( $ trim_padding_chars [ 0 ] ) ? rtrim ( $ base64_url_safe , $ trim_padding_chars ) : $ base64_url_safe ; $ string = isset ( $ trim_padding_chars [ 0 ] ) ? str_pad ( $ string , strlen ( $ string ) % 4 , '=' , STR_PAD_RIGHT ) : $ string ; $ string = str_replace ( $ url_safe_chars , $ url_unsafe_chars , $ string ) ; if ( ! is_string ( $ string = base64_decode ( $ string , true ) ) ) { throw $ this -> c :: issue ( 'Base64 decoding failure.' ) ; } return $ string ; }
Base64 URL-safe decoding.

@since 150424 Initial release.

@param string $base64_url_safe    Input string to be base64 decoded.
@param array  $url_unsafe_chars   Optional array of un-safe characters. Defaults to: `['+', '/']`.
@param array  $url_safe_chars     Optional array of safe character replacements. Defaults to: `['-', '_']`.
@param string $trim_padding_chars Optional string of padding chars to right-trim. Defaults to: `=`.

@throws Exception If the call to `base64_decode()` fails.

@return string The decoded string value.
Base64 URL - safe decoding .