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

FixtureService::whitelist()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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