Validator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validate() 0 8 2
A addConstraintValidator() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\Response\Validation;
6
7
use SimpleSAML\SAML2\XML\samlp\Response;
8
9
class Validator
10
{
11
    /** @var \SimpleSAML\SAML2\Response\Validation\ConstraintValidator[] */
12
    protected array $constraints = [];
13
14
15
    /**
16
     * @param \SimpleSAML\SAML2\Response\Validation\ConstraintValidator $constraint
17
     */
18
    public function addConstraintValidator(ConstraintValidator $constraint): void
19
    {
20
        $this->constraints[] = $constraint;
21
    }
22
23
24
    /**
25
     * @param \SimpleSAML\SAML2\XML\samlp\Response $response
26
     * @return \SimpleSAML\SAML2\Response\Validation\Result
27
     */
28
    public function validate(Response $response): Result
29
    {
30
        $result = new Result();
31
        foreach ($this->constraints as $validator) {
32
            $validator->validate($response, $result);
33
        }
34
35
        return $result;
36
    }
37
}
38