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.

GeniusService::zawGyiToUnicode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
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 SteveNay\MyanFont\MyanFont;
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
     * @param string $content
83
     * @param string $default
84
     * @return string
85
     */
86
    public function fontDetect(string $content, $default = "zawgyi")
87
    {
88
        return MyanFont::fontDetect($content, $default);
89
    }
90
91
    /**
92
     * @param string $content
93
     * @return bool
94
     */
95
    public function isMyanmarSar(string $content)
96
    {
97
        return MyanFont::isMyanmarSar($content);
98
    }
99
100
    /**
101
     * @param string $content
102
     * @return mixed
103
     */
104
    public function zawGyiToUnicode(string $content)
105
    {
106
        return MyanFont::uni2zg($content);
107
    }
108
109
    /**
110
     * @param string $content
111
     * @return mixed
112
     */
113
    public function unicodeToZawGyi(string $content)
114
    {
115
        return MyanFont::uni2zg($content);
116
    }
117
}
118
119