Passed
Push — master ( 765b41...e6bf79 )
by Tim
03:49 queued 01:38
created

SAMLAnyURITrait::validSAMLAnyURI()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 18
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 18
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML11\Assert;
6
7
use SimpleSAML\Assert\AssertionFailedException;
8
use SimpleSAML\SAML11\Exception\ProtocolViolationException;
9
10
/**
11
 * @package simplesamlphp/saml11
12
 */
13
trait SAMLAnyURITrait
14
{
15
    /**
16
     * @param string $value
17
     * @param string $message
18
     */
19
    protected static function validSAMLAnyURI(string $value, string $message = ''): void
20
    {
21
        parent::validAnyURI($value, $message);
22
23
        try {
24
            /**
25
             * 1.2.1 String and URI Values
26
             *
27
             * Unless otherwise indicated in this specification, all URI reference values MUST consist
28
             * of at least one non-whitespace character
29
             */
30
            static::notWhitespaceOnly(
31
                $value,
32
                $message ?: '%s is not a SAML1.1-compliant URI',
33
                ProtocolViolationException::class,
34
            );
35
        } catch (AssertionFailedException $e) {
36
            throw new ProtocolViolationException($e->getMessage());
37
        }
38
    }
39
}
40