Completed
Push — master ( 10ba62...05ba98 )
by Ashley
01:10
created

BasicAuth   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkBasic() 0 8 4
1
<?php
2
3
namespace Shield\Shield\Support;
4
5
use Illuminate\Http\Request;
6
7
trait BasicAuth
8
{
9
    /**
10
     * @param \Illuminate\Http\Request $request
11
     * @param string                   $username
12
     * @param string                   $password
13
     *
14
     * @return bool
15
     */
16 3
    public function checkBasic(Request $request, string $username, string $password): bool
17
    {
18 3
        if ($request->hasHeader('PHP-AUTH-USER') && $request->hasHeader('PHP-AUTH-PW')) {
19 2
            return $request->header('PHP-AUTH-USER') == $username && $request->header('PHP-AUTH-PW') == $password;
20
        }
21
22 1
        return false;
23
    }
24
}
25