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.
Passed
Push — master ( 5860e0...cdc571 )
by Htin
03:14
created

GeniusService::toUnicode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: htinlynn
5
 * Date: 11/26/18
6
 * Time: 4:17 PM
7
 */
8
9
namespace Genius\Services;
10
11
12
use Genius\Contacts\GeniusInterface;
13
use Rabbit;
0 ignored issues
show
Bug introduced by
The type Rabbit was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
15
/**
16
 * Class     Genius Service
17
 *
18
 * @package  Htinlynn\Genius\Service
19
 * @author   HtinLynn <[email protected]>
20
 */
21
class GeniusService implements GeniusInterface
22
{
23
    /**
24
     * Genius constructor.
25
     */
26
    public function __construct()
27
    {
28
29
    }
30
31
    /**
32
     * @param $length
33
     * @param $count
34
     * @return string
35
     */
36
    public function randomDigit($length, $count): string
37
    {
38
        $codes = [];
39
        $stringDigits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
40
41
        while (count($codes) < $count) {
42
            $randomString = '';
43
            for ($i = 0; $i < $length; $i++) {
44
                $randomString = (string)$randomString . substr($stringDigits, rand(0, strlen($stringDigits) - 1), 1);
45
            }
46
            if (!in_array($randomString, $codes)) {
47
                $codes[] = (string)$randomString;
48
            }
49
        }
50
51
        return (string)$codes;
52
    }
53
54
    /**
55
     * @param $size
56
     * @return string
57
     */
58
    public function formatBytes($size): string
59
    {
60
        $base = log($size) / log(1024);
61
        $suffix = array("", "KB", "MB", "GB", "TB");
62
        $f_base = floor($base);
63
        return round(pow(1024, $base - floor($base)), 1) . $suffix[$f_base];
64
    }
65
66
    /**
67
     * @param $needle
68
     * @param $haystack
69
     * @author Pyae Hein
70
     * @return bool
71
     */
72
    public function inArrayInsensitive($needle, $haystack): bool
73
    {
74
        $needle = strtolower($needle);
75
        foreach ($haystack as $k => $v) {
76
            $haystack[$k] = strtolower($v);
77
        }
78
        return in_array($needle, $haystack);
79
    }
80
}
81
82