SsoIdpAssertionActionBuilder::doInitialize()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 62

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 62
ccs 0
cts 55
cp 0
rs 8.829
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/*
4
 * This file is part of the LightSAML-IDP package.
5
 *
6
 * (c) Milos Tomic <[email protected]>
7
 *
8
 * This source file is subject to the GPL-3 license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace LightSaml\Idp\Builder\Action\Profile\SingleSignOn\Idp;
13
14
use LightSaml\Idp\Action\Assertion\Outbound\AssertionIdAction;
15
use LightSaml\Idp\Action\Assertion\Outbound\AssertionIssueInstantAction;
16
use LightSaml\Idp\Action\Assertion\Outbound\AssertionVersionAction;
17
use LightSaml\Idp\Action\Assertion\Outbound\AttributeAction;
18
use LightSaml\Idp\Action\Assertion\Outbound\AuthnStatementAction;
19
use LightSaml\Idp\Action\Assertion\Outbound\ConditionsAction;
20
use LightSaml\Idp\Action\Assertion\Outbound\CreateAssertionAction;
21
use LightSaml\Idp\Action\Assertion\Outbound\CreateAssertionIssuerAction;
22
use LightSaml\Idp\Action\Assertion\Outbound\EncryptAssertionAction;
23
use LightSaml\Idp\Action\Assertion\Outbound\IdpSsoStateAction;
24
use LightSaml\Idp\Action\Assertion\Outbound\SignAssertionAction;
25
use LightSaml\Idp\Action\Assertion\Outbound\SubjectConfirmationAction;
26
use LightSaml\Idp\Action\Assertion\Outbound\SubjectNameIdAction;
27
use LightSaml\Builder\Action\Profile\AbstractProfileActionBuilder;
28
use LightSaml\SamlConstants;
29
30
class SsoIdpAssertionActionBuilder extends AbstractProfileActionBuilder
31
{
32
    /**
33
     * @return void
34
     */
35
    protected function doInitialize()
36
    {
37
        $this->add(new CreateAssertionAction(
38
            $this->buildContainer->getSystemContainer()->getLogger()
39
        ), 100);
40
        $this->add(new AssertionIdAction(
41
            $this->buildContainer->getSystemContainer()->getLogger()
42
        ));
43
        $this->add(new AssertionIssueInstantAction(
44
            $this->buildContainer->getSystemContainer()->getLogger(),
45
            $this->buildContainer->getSystemContainer()->getTimeProvider()
46
        ));
47
        $this->add(new AssertionVersionAction(
48
            $this->buildContainer->getSystemContainer()->getLogger(),
49
            SamlConstants::VERSION_20
50
        ));
51
52
        $this->add(new CreateAssertionIssuerAction(
53
            $this->buildContainer->getSystemContainer()->getLogger()
54
        ));
55
56
        $this->add(new SubjectNameIdAction(
57
            $this->buildContainer->getSystemContainer()->getLogger(),
58
            $this->buildContainer->getProviderContainer()->getNameIdProvider()
59
        ));
60
        $this->add(new SubjectConfirmationAction(
61
            $this->buildContainer->getSystemContainer()->getLogger(),
62
            $this->buildContainer->getSystemContainer()->getTimeProvider(),
63
            120
64
        ));
65
66
        $this->add(new ConditionsAction(
67
            $this->buildContainer->getSystemContainer()->getLogger(),
68
            $this->buildContainer->getSystemContainer()->getTimeProvider(),
69
            120
70
        ));
71
72
        $this->add(new AttributeAction(
73
            $this->buildContainer->getSystemContainer()->getLogger(),
74
            $this->buildContainer->getProviderContainer()->getAttributeValueProvider(),
75
            120
0 ignored issues
show
Unused Code introduced by
The call to AttributeAction::__construct() has too many arguments starting with 120.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
76
        ));
77
78
        $this->add(new AuthnStatementAction(
79
            $this->buildContainer->getSystemContainer()->getLogger(),
80
            $this->buildContainer->getProviderContainer()->getSessionInfoProvider()
81
        ));
82
83
        $this->add(new SignAssertionAction(
84
            $this->buildContainer->getSystemContainer()->getLogger(),
85
            $this->buildContainer->getServiceContainer()->getSignatureResolver()
86
        ));
87
        $this->add(new IdpSsoStateAction(
88
            $this->buildContainer->getSystemContainer()->getLogger(),
89
            $this->buildContainer->getServiceContainer()->getSessionProcessor()
90
        ));
91
92
        $this->add(new EncryptAssertionAction(
93
            $this->buildContainer->getSystemContainer()->getLogger(),
94
            $this->buildContainer->getServiceContainer()->getCredentialResolver()
95
        ));
96
    }
97
}
98