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.

Base64   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 7
c 2
b 1
f 0
dl 0
loc 34
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A encode() 0 5 1
A decode() 0 5 1
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Security\Encoders;
15
16
// ------------------------------------------------------------------------
17
18
/**
19
 * Class Base64
20
 * @package O2System\Security\Encoders
21
 */
22
class Base64
23
{
24
    /**
25
     * Base64::encode
26
     *
27
     * Encrypt a string with URL-Safe Base64.
28
     *
29
     * @param $string
30
     *
31
     * @return string
32
     */
33
    public static function encode($string)
34
    {
35
        return str_replace(['+', '/', '\r', '\n', '='],
36
            ['-', '_'],
37
            base64_encode($string));
38
    }
39
40
    // ------------------------------------------------------------------------
41
42
    /**
43
     * Base64::decode
44
     *
45
     * Decrypt a string with URL-Safe Base64.
46
     *
47
     * @param $string
48
     *
49
     * @return bool|string
50
     */
51
    public static function decode($string)
52
    {
53
        return base64_decode(str_replace(['-', '_'],
54
            ['+', '/'],
55
            $string));
56
    }
57
}