Passed
Pull Request — master (#43)
by
unknown
25:27 queued 21:45
created

ProcessingChainFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 12
dl 0
loc 30
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 15 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the simplesamlphp-module-casserver.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace SimpleSAML\Module\casserver\Cas\Factories;
13
14
use SimpleSAML\Auth\ProcessingChain;
15
use SimpleSAML\Configuration;
16
17
class ProcessingChainFactory
18
{
19
    /** @var Configuration */
20
    private readonly Configuration $casconfig;
21
22
    public function __construct(
23
        Configuration $casconfig,
24
    ) {
25
        $this->casconfig = $casconfig;
0 ignored issues
show
Bug introduced by
The property casconfig is declared read-only in SimpleSAML\Module\casser...\ProcessingChainFactory.
Loading history...
26
    }
27
28
    /**
29
     * @codeCoverageIgnore
30
     * @throws \Exception
31
     */
32
    public function build(array $state): ProcessingChain
33
    {
34
        $idpMetadata = [
35
            'entityid' => $state['Source']['entityid'] ?? '',
36
            // ProcessChain needs to know the list of authproc filters we defined in casserver configuration
37
            'authproc' => $this->casconfig->getOptionalArray('authproc', []),
38
        ];
39
        $spMetadata = [
40
            'entityid' => $state['Destination']['entityid'] ?? '',
41
        ];
42
43
        return new ProcessingChain(
44
            $idpMetadata,
45
            $spMetadata,
46
            'casserver',
47
        );
48
    }
49
}
50