Passed
Push — master ( 78e48b...97e118 )
by Tim
01:34
created

AbstractManageNameIDRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 8
dl 0
loc 13
rs 10

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\XML\samlp;
6
7
use DOMElement;
8
use SimpleSAML\SAML2\Type\SAMLAnyURIValue;
9
use SimpleSAML\SAML2\Type\SAMLDateTimeValue;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\Type\SAMLDateTimeValue was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use SimpleSAML\SAML2\XML\IdentifierTrait;
11
use SimpleSAML\SAML2\XML\saml\EncryptedID;
12
use SimpleSAML\SAML2\XML\saml\Issuer;
13
use SimpleSAML\SAML2\XML\saml\NameID;
14
use SimpleSAML\SAML2\XML\samlp\NewEncryptedID;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\XML\samlp\NewEncryptedID was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use SimpleSAML\SAML2\XML\samlp\NewID;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\XML\samlp\NewID was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use SimpleSAML\SAML2\XML\samlp\Terminate;
17
use SimpleSAML\XMLSchema\Type\IDValue;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\XMLSchema\Type\IDValue was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
19
/**
20
 * Class representing the samlp:ManageNameIDRequestType.
21
 *
22
 * @package simplesamlphp/saml2
23
 */
24
abstract class AbstractManageNameIDRequest extends AbstractRequest
25
{
26
    use IdentifierTrait;
27
28
29
    /**
30
     * Initialize a ManageNameIDRequest.
31
     *
32
     * @param \SimpleSAML\SAML2\XML\saml\NameID|\SimpleSAML\SAML2\XML\saml\EncryptedID $identifier
33
     * @param (
34
     *   \SimpleSAML\SAML2\XML\samlp\NewID|
35
     *   \SimpleSAML\SAML2\XML\samlp\NewEncryptedID|
36
     *   \SimpleSAML\SAML2\XML\samlp\Terminate
37
     * ) $newIdentifier
38
     * @param \SimpleSAML\XMLSchema\Type\IDValue $id
39
     * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer
40
     * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $issueInstant
41
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination
42
     * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent
43
     * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions
44
     */
45
    final public function __construct(
46
        NameID|EncryptedID $identifier,
47
        protected NewID|NewEncryptedID|Terminate $newIdentifier,
48
        IDValue $id,
49
        ?Issuer $issuer = null,
50
        ?SAMLDateTimeValue $issueInstant = null,
51
        ?SAMLAnyURIValue $destination = null,
52
        ?SAMLAnyURIValue $consent = null,
53
        ?Extensions $extensions = null,
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\XML\samlp\Extensions was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
54
    ) {
55
        $this->setIdentifier($identifier);
56
57
        parent::__construct($id, $issuer, $issueInstant, $destination, $consent, $extensions);
58
    }
59
60
61
    /**
62
     * Retrieve the new identifier.
63
     *
64
     * @return (
0 ignored issues
show
Documentation Bug introduced by
The doc comment ( at position 1 could not be parsed: the token is null at position 1.
Loading history...
65
     *   \SimpleSAML\SAML2\XML\samlp\NewID|
66
     *   \SimpleSAML\SAML2\XML\samlp\NewEncryptedID|
67
     *   \SimpleSAML\SAML2\XML\samlp\Terminate
68
     * )
69
     */
70
    public function getNewIdentifier(): NewID|NewEncryptedID|Terminate
71
    {
72
        return $this->newIdentifier;
73
    }
74
75
76
    /**
77
     * Convert this ManageNameIDRequest to XML
78
     */
79
    public function toUnsignedXML(?DOMElement $parent = null): DOMElement
80
    {
81
        $e = parent::toUnsignedXML($parent);
82
83
        $this->getIdentifier()->toXML($e);
84
        $this->getNewIdentifier()->toXML($e);
85
86
        return $e;
87
    }
88
}
89