Passed
Pull Request — master (#363)
by Tim
02:37
created

IdentityProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 9
dl 0
loc 21
rs 9.9332

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\Metadata;
6
7
use SimpleSAML\XMLSecurity\Constants as C;
8
use SimpleSAML\XMLSecurity\Key\{PrivateKey, PublicKey, SymmetricKey};
9
10
/**
11
 * Class holding configuration for a SAML 2 Identity Provider.
12
 *
13
 * @package simplesamlphp/saml2
14
 */
15
class IdentityProvider extends AbstractProvider
16
{
17
    /**
18
     */
19
    public function __construct(
20
        string $entityId,
21
        string $signatureAlgorithm = C::SIG_RSA_SHA256,
22
        array $validatingKeys = [],
23
        ?PrivateKey $signingKey = null,
24
        ?PublicKey $encryptionKey = null,
25
        array $decryptionKeys = [],
26
        ?SymmetricKey $preSharedKey = null,
27
        string $preSharedKeyAlgorithm = C::BLOCK_ENC_AES256_GCM,
28
        array $IDPList = [],
29
    ) {
30
        parent::__construct(
31
            $entityId,
32
            $signatureAlgorithm,
33
            $validatingKeys,
34
            $signingKey,
35
            $encryptionKey,
36
            $decryptionKeys,
37
            $preSharedKey,
38
            $preSharedKeyAlgorithm,
39
            $IDPList,
40
        );
41
    }
42
}
43