GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Str::random()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
namespace anerg\OAuth2\Helper;
3
4
class Str
5
{
6
    public static function uFirst($str)
7
    {
8
        return ucfirst(strtolower($str));
9
    }
10
11
    public static function buildParams($params, $urlencode = false, $except = ['sign'])
12
    {
13
        $param_str = '';
14
        foreach ($params as $k => $v) {
15
            if (in_array($k, $except)) {
16
                continue;
17
            }
18
            $param_str .= $k . '=';
19
            $param_str .= $urlencode ? rawurlencode($v) : $v;
20
            $param_str .= '&';
21
        }
22
        return rtrim($param_str, '&');
23
    }
24
25
    public static function random($length = 16)
26
    {
27
        $str_pol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
28
        return substr(str_shuffle($str_pol), 0, $length);
29
    }
30
31
    public static function getClientIP()
32
    {
33
        $ip = '127.0.0.1';
34
        if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']) {
35
            $ip = $_SERVER['REMOTE_ADDR'];
36
        } else if (getenv('REMOTE_ADDR')) {
37
            $ip = getenv('REMOTE_ADDR');
38
        }
39
        return $ip;
40
    }
41
}
42