Passed
Push — master ( 6d44e6...724433 )
by Tim
02:38
created

RelayStateTrait::getRelayState()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\Binding;
6
7
use SimpleSAML\SAML2\Assert\Assert;
8
9
/**
10
 * Trait grouping common functionality for binding that use a RelayState.
11
 *
12
 * @package simplesamlphp/saml2
13
 */
14
trait RelayStateTrait
15
{
16
    /**
17
     * The relay state.
18
     *
19
     * @var string|null
20
     */
21
    protected ?string $relayState = null;
22
23
24
    /**
25
     * Set the RelayState associated with he message.
26
     *
27
     * @param string|null $relayState The RelayState.
28
     */
29
    public function setRelayState(?string $relayState = null): void
30
    {
31
        Assert::nullOrValidRelayState($relayState);
32
        $this->relayState = $relayState;
33
    }
34
35
36
    /**
37
     * Get the RelayState associated with the message.
38
     *
39
     * @return string|null The RelayState.
40
     */
41
    public function getRelayState(): ?string
42
    {
43
        return $this->relayState;
44
    }
45
}
46