DummyPasswordEnricher   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 3
b 0
f 0
dl 0
loc 10
rs 10
ccs 5
cts 5
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DMK\MKSamlAuth\Enricher;
6
7
use DMK\MKSamlAuth\Model\FrontendUser;
8
9
class DummyPasswordEnricher implements EnricherInterface
10
{
11 3
    public function process(FrontendUser $user, array $context)
12
    {
13 3
        if ($user->hasProperty('password') && $user->getProperty('password')) {
14 1
            return;
15
        }
16
17 2
        $password = base64_encode(random_bytes(32));
18 2
        $user->setProperty('password', $password);
19 2
    }
20
}
21