Completed
Push — master ( b5ea74...804f63 )
by Dmitry
02:00
created

my-credentials.php$1 ➔ decode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 1
rs 10
1
<?php
2
3
/* Экземпляр класса идентификации  */
4
5
$identity = new class implements \Promopult\Integra\IdentityInterface {
6
    public function getHash(): string { return getenv('__HASH__'); }
7
    public function getCryptKey(): string { return getenv('__CRYPT_KEY__'); }
8
    public function getPartnerPath(): string { return getenv('__PARTNER_PATH__'); }
9
    public function getApiHost(): string { return getenv('__API_HOST__'); }
10
};
11
12
/* Экземпляр класса реализующий шифрование данных */
13
14
$crypt = new class implements \Promopult\Integra\CryptInterface {
15
    public function encode(string $s, string $ck): string {
16
        $r = '';
17
        for ($i = 0; $i < strlen($s); $i++) {
18
            $r .= chr(ord(substr($s, $i, 1)) + ord(substr($ck, ($i % strlen($ck)) - 1, 1)));
19
        }
20
        return base64_encode($r);
21
    }
22
    public function decode(string $string, string $key): string { return ''; }
23
};
24