Passed
Pull Request — master (#61)
by Tim
02:17
created

AbstractLocalElement::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 33
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 16
nc 1
nop 15
dl 0
loc 33
rs 9.7333
c 1
b 0
f 0

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\XMLSchema\XML\xs;
6
7
use SimpleSAML\XMLSchema\Type\Builtin\{BooleanValue, IDValue, NCNameValue, QNameValue, StringValue};
8
use SimpleSAML\XMLSchema\Type\{BlockSetValue, DerivationSetValue, FormChoiceValue, MaxOccursValue, MinOccursValue};
9
10
/**
11
 * Abstract class representing the localElement-type.
12
 *
13
 * @package simplesamlphp/xml-common
14
 */
15
abstract class AbstractLocalElement extends AbstractElement
16
{
17
    /**
18
     * Element constructor
19
     *
20
     * @param \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue|null $name
21
     * @param \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null $reference
22
     * @param \SimpleSAML\XMLSchema\XML\xs\LocalSimpleType|\SimpleSAML\XMLSchema\XML\xs\LocalComplexType|null $localType
23
     * @param array<\SimpleSAML\XMLSchema\XML\xs\IdentityConstraintInterface> $identityConstraint
24
     * @param \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null $type
25
     * @param \SimpleSAML\XMLSchema\Type\MinOccursValue|null $minOccurs
26
     * @param \SimpleSAML\XMLSchema\Type\MaxOccursValue|null $maxOccurs
27
     * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $default
28
     * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $fixed
29
     * @param \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null $nillable
30
     * @param \SimpleSAML\XMLSchema\Type\BlockSetValue|null $block
31
     * @param \SimpleSAML\XMLSchema\Type\FormChoiceValue|null $form
32
     * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
33
     * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
34
     * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
35
     */
36
    public function __construct(
37
        ?NCNameValue $name = null,
38
        ?QNameValue $reference = null,
39
        LocalSimpleType|LocalComplexType|null $localType = null,
40
        array $identityConstraint = [],
41
        ?QNameValue $type = null,
42
        ?MinOccursValue $minOccurs = null,
43
        ?MaxOccursValue $maxOccurs = null,
44
        ?StringValue $default = null,
45
        ?StringValue $fixed = null,
46
        ?BooleanValue $nillable = null,
47
        ?BlockSetValue $block = null,
48
        ?FormChoiceValue $form = null,
49
        ?Annotation $annotation = null,
50
        ?IDValue $id = null,
51
        array $namespacedAttributes = [],
52
    ) {
53
        parent::__construct(
54
            name: $name,
55
            reference: $reference,
56
            localType: $localType,
57
            identityConstraint: $identityConstraint,
58
            type: $type,
59
            minOccurs: $minOccurs,
60
            maxOccurs: $maxOccurs,
61
            default: $default,
62
            fixed: $fixed,
63
            nillable: $nillable,
64
            block: $block,
65
            form: $form,
66
            annotation: $annotation,
67
            id: $id,
68
            namespacedAttributes: $namespacedAttributes,
69
        );
70
    }
71
}
72