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

RelayStateTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 30
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setRelayState() 0 4 1
A getRelayState() 0 3 1
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