Passed
Pull Request — master (#22)
by Tim
20:50 queued 06:14
created

adfs_hook_generate_metadata()   A

Complexity

Conditions 6
Paths 6

Size

Total Lines 19
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
eloc 16
nc 6
nop 1
dl 0
loc 19
rs 9.1111
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
use SimpleSAML\Assert\Assert;
6
use SimpleSAML\SAML2\Constants as C;
7
use SimpleSAML\{Configuration, Utils, Logger, Module};
8
use SimpleSAML\Locale\Translate;
9
use SimpleSAML\Metadata\MetaDataStorageHandler;
10
11
function adfs_hook_generate_metadata(array &$hookinfo): void
12
{
13
    if ($hookinfo['set'] === 'adfs-idp-hosted') {
14
        $property = $hookinfo['property'];
15
        $endpoint = Module::getModuleURL('adfs/idp/prp.php');
16
17
        switch ($property) {
18
            case 'SingleSignOnService':
19
                $hookinfo['result'] = $endpoint;
20
                break;
21
            case 'SingleSignOnServiceBinding':
22
                $hookinfo['result'] = C::BINDING_HTTP_REDIRECT;
23
                break;
24
            case 'SingleLogoutService':
25
                $hookinfo['result'] = $endpoint;
26
                break;
27
            case 'SingleLogoutServiceBinding':
28
                $hookinfo['result'] = C::BINDING_HTTP_REDIRECT;
29
                break;
30
        }
31
    }
32
}
33
34