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   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 36
rs 10
wmc 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A uFirst() 0 3 1
A getClientIP() 0 9 4
A buildParams() 0 12 4
A random() 0 4 1
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