Issues (69)

src/helper.php (1 issue)

1
<?php
2
namespace ArcherZdip\LaravelApiAuth\Helper;
3
4
/**
5
 * Return the Base64-encoded version of $data, The alphabet uses '-' instead of '+' and '_' instead of '/'.
6
 *
7
 * @param $data
8
 * @return mixed
9
 */
10
function base64_urlsafe_encode($data)
11
{
12
    return str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($data));
13
}
14
15
16
/**
17
 * Return the Base64-decoded version of $data, The alphabet uses '-' instead of '+' and '_' instead of '/'.
18
 *
19
 * @param $data
20
 * @param null $strict
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $strict is correct as it would always require null to be passed?
Loading history...
21
 * @return bool|string
22
 */
23
function base64_urlsafe_decode($data, $strict = null)
24
{
25
    return base64_decode(str_replace(['-', '_'], ['+', '/'], $data), $strict);
26
}