Completed
Push — master ( f780e5...fe78ad )
by Dmitry
01:43 queued 23s
created

my-credentials.php$0 ➔ encrypt()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
$identity = new \Promopult\Integra\Identity(
4
    getenv('__HASH__'),
5
    getenv('__CRYPT_KEY__'),
6
    getenv('__PARTNER_PATH__'),
7
    getenv('__API_HOST__')
8
);
9
10
$crypt = new class implements \Promopult\Integra\CryptInterface {
11
    public function encrypt(string $s, string $ck): string {
12
        $r = '';
13
        for ($i = 0; $i < strlen($s); $i++) {
14
            $r .= chr(ord(substr($s, $i, 1)) + ord(substr($ck, ($i % strlen($ck)) - 1, 1)));
15
        }
16
        return base64_encode($r);
17
    }
18
    public function decrypt(string $string, string $key): string { return ''; }
19
};
20