create_basic_credentials()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace PFlorek\BasicAuth;
4
5
function create_basic_credentials($username, $password)
6
{
7
    $userPass = "{$username}:{$password}";
8
    $basicCredentials = base64_encode($userPass);
9
10
    return $basicCredentials;
11
}
12
13
function retrieve_username_and_password($basicCredentials)
14
{
15
    $userPass = base64_decode($basicCredentials);
16
17
    return explode(':', $userPass) + ['', ''];
18
}
19