Passed
Push — master ( fb3113...2f4a0c )
by Tim
02:23
created

ActionTrait::setAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\WSSecurity\XML\wsaw;
6
7
use SimpleSAML\Assert\Assert;
8
use SimpleSAML\XML\Exception\SchemaViolationException;
9
10
/**
11
 * Trait adding methods to handle elements that define the action-attribute.
12
 *
13
 * @package simplesamlphp/ws-security
14
 */
15
trait ActionTrait
16
{
17
    /**
18
     * @var string|null
19
     */
20
    protected ?string $action;
21
22
23
    /**
24
     * Collect the value of the action property.
25
     *
26
     * @return string|null
27
     */
28
    public function getAction(): ?string
29
    {
30
        return $this->action;
31
    }
32
33
34
    /**
35
     * Set the value of the action property.
36
     *
37
     * @param string|null $action
38
     * @throws \SimpleSAML\XML\Exception\SchemViolationException
39
     */
40
    protected function setAction(?string $action): void
41
    {
42
        Assert::nullOrValidURI($action, SchemaViolationException::class);
43
        $this->action = $action;
44
    }
45
}
46