Completed
Pull Request — feature/acceptance-tests (#191)
by Michiel
02:42 queued 58s
created

FixtureService   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 3
cbo 3
dl 0
loc 51
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A registerYubikeyToken() 0 4 1
A registerSP() 0 4 1
A whitelist() 0 4 1
1
<?php
2
3
namespace Surfnet\StepupGateway\Behat\Service;
4
5
use Exception;
6
use Surfnet\StepupGateway\Behat\Repository\SamlEntityRepository;
7
use Surfnet\StepupGateway\Behat\Repository\SecondFactorRepository;
8
use Surfnet\StepupGateway\Behat\Repository\WhitelistRepository;
9
10
class FixtureService
11
{
12
    private $secondFactorRepository;
13
14
    private $samlEntityRepository;
15
16
    private $whitelistRepository;
17
18
    public function __construct(
19
        SecondFactorRepository $secondFactorRepository,
20
        SamlEntityRepository $samlRepository,
21
        WhitelistRepository $whitelistRepository
22
    ) {
23
        $this->secondFactorRepository = $secondFactorRepository;
24
        $this->samlEntityRepository = $samlRepository;
25
        $this->whitelistRepository = $whitelistRepository;
26
    }
27
28
    /**
29
     * @param string $nameId
30
     * @param string $institution
31
     * @return array
32
     * @throws Exception
33
     */
34
    public function registerYubikeyToken($nameId, $institution)
35
    {
36
        return $this->secondFactorRepository->create($nameId, 'yubikey', $institution);
37
    }
38
39
    /**
40
     * @param string $entityId
41
     * @param string $certificate
42
     * @param bool $sfoEnabled
43
     * @return array
44
     * @throws Exception
45
     */
46
    public function registerSP($entityId, $certificate, $sfoEnabled)
47
    {
48
        return $this->samlEntityRepository->createSp($entityId, $certificate, $sfoEnabled);
49
    }
50
51
    /**
52
     * @param string $institution
53
     * @return array
54
     * @throws Exception
55
     */
56
    public function whitelist($institution)
57
    {
58
        return $this->whitelistRepository->whitelist($institution);
59
    }
60
}
61