Authenticator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 26
ccs 6
cts 7
cp 0.8571
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkCredentials() 0 14 3
1
<?php
2
3
namespace CodeZero\StageFront;
4
5
use CodeZero\StageFront\Authenticators\DatabaseAuthenticator;
6
use CodeZero\StageFront\Authenticators\EncryptedAuthenticator;
7
use CodeZero\StageFront\Authenticators\PlainTextAuthenticator;
8
use Illuminate\Support\Facades\App;
9
use Illuminate\Support\Facades\Config;
10
11
class Authenticator
12
{
13
    /**
14
     * Use an applicable check to verify that
15
     * the given credentials are valid.
16
     *
17
     * @param string $login
18
     * @param string $password
19
     *
20
     * @return bool
21
     */
22 9
    public static function checkCredentials($login, $password)
23
    {
24
        $checkers = [
25 9
            DatabaseAuthenticator::class => Config::get('stagefront.database') === true,
26 9
            EncryptedAuthenticator::class => Config::get('stagefront.encrypted') === true,
27
            PlainTextAuthenticator::class => true, //=> Default
28
        ];
29
30 9
        foreach ($checkers as $checker => $applicable) {
31 9
            if ($applicable === true) {
32 9
                return App::make($checker)->check($login, $password);
33
            }
34
        }
35
    }
36
}
37