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.
Completed
Push — master ( 6d880e...6fcb7a )
by t
05:21 queued 03:08
created

Unicode::decode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
/**
3
 * Class Unicode
4
 * @link https://www.icy2003.com/
5
 * @author icy2003 <[email protected]>
6
 * @copyright Copyright (c) 2017, icy2003
7
 */
8
namespace icy2003\php\ihelpers;
9
10
/**
11
 * Unicode 编码/解码
12
 */
13
class Unicode
14
{
15
    /**
16
     * Unicode 编码
17
     *
18
     * @param string $string
19
     *
20
     * @return string
21
     */
22
    public static function encode($string)
23
    {
24
        return trim(json_encode($string), '"');
25
    }
26
27
    /**
28
     * Unicode 解码
29
     *
30
     * @param string $string
31
     *
32
     * @return string
33
     */
34
    public static function decode($string)
35
    {
36
        return implode('', Json::decode('["' . $string . '"]'));
37
    }
38
}
39