RelayStateTrait::validRelayState()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 14
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 14
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\Assert;
6
7
use SimpleSAML\SAML2\Constants as C;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\Constants was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
9
10
/**
11
 * @package simplesamlphp/saml2
12
 */
13
trait RelayStateTrait
14
{
15
    /**
16
     */
17
    protected static function validRelayState(string $value, string $message = ''): void
18
    {
19
        parent::notWhitespaceOnly($value, $message); // Not protocol-defined, but makes zero sense
20
21
        /**
22
         * 3.4.3 RelayState
23
         *
24
         * The value MUST NOT exceed 80 bytes in length [..]
25
         */
26
        parent::maxLength(
27
            $value,
28
            C::MAX_RELAY_STATE_LENGTH,
29
            $message ?: '%s is not a SAML2.0-compliant RelayState',
30
            ProtocolViolationException::class,
31
        );
32
    }
33
}
34