Issues (1)

src/helpers.php (1 issue)

Labels
Severity
1
<?php
2
3
use Illuminate\Support\Arr;
4
5
if (! function_exists('gravatar')) {
6
    /**
7
     * Generate Gravatar avatar URL for the given email address.
8
     *
9
     * @param  string      $email       Email or email hash
10
     * @param  string|int  $connection  Connection name or image size
11
     * @param  string|int  $size        Connection name or image size
12
     * @return string
13
     */
14
    function gravatar($email, $connection = 'default', $size = null)
15
    {
16 20
        $hash = strlen($email) == 32 && ctype_xdigit($email)
17 4
            ? strtolower($email)
18 20
            : md5(strtolower(trim($email)));
19
20 20
        if (is_int($connection)) {
21
            list($connection, $size) = [
22 16
                is_string($size) ? $size : 'default', $connection,
23
            ];
24
        }
25
26 20
        $config = array_filter(config('gravatar.'.$connection, []));
27
28 20
        if ($size) {
29 16
            unset($config['s']);
30 16
            $config['size'] = $size;
31
        }
32
33 20
        $url = Arr::pull($config, 'url', 'https://secure.gravatar.com/avatar');
34 20
        $query = http_build_query($config, null, '&', PHP_QUERY_RFC3986);
0 ignored issues
show
null of type null is incompatible with the type string expected by parameter $numeric_prefix of http_build_query(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

34
        $query = http_build_query($config, /** @scrutinizer ignore-type */ null, '&', PHP_QUERY_RFC3986);
Loading history...
35
36 20
        return $url.'/'.$hash.($query ? '?'.$query : '');
37
    }
38
}
39