SAMLStringTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 18
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A validSAMLString() 0 14 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\Assert;
6
7
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
8
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
9
10
/**
11
 * @package simplesamlphp/saml2
12
 */
13
trait SAMLStringTrait
14
{
15
    /**
16
     */
17
    protected static function validSAMLString(string $value, string $message = ''): void
18
    {
19
        parent::validString($value, $message, SchemaViolationException::class);
20
21
        /**
22
         * 1.3.1 String Values
23
         *
24
         * Unless otherwise noted in this specification or particular profiles, all strings in
25
         * SAML messages MUST consist of at least one non-whitespace character
26
         */
27
        parent::notWhitespaceOnly(
28
            $value,
29
            $message ?: '%s is not a SAML2.0-compliant string',
30
            ProtocolViolationException::class,
31
        );
32
    }
33
}
34