OptionalTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getOptional() 0 3 1
A setOptional() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\WSSecurity\XML\wsp;
6
7
/**
8
 * Trait grouping common functionality for elements that can hold an Optional attribute.
9
 *
10
 * @package simplesamlphp/ws-security
11
 */
12
trait OptionalTrait
13
{
14
    /**
15
     * The Optional.
16
     *
17
     * @var bool
18
     */
19
    protected bool $Optional;
20
21
22
    /**
23
     * Collect the value of the Optional-property
24
     *
25
     * @return bool
26
     */
27
    public function getOptional(): bool
28
    {
29
        return $this->Optional;
30
    }
31
32
33
    /**
34
     * Set the value of the Optional-property
35
     *
36
     * @param bool $Optional
37
     */
38
    protected function setOptional(?bool $Optional): void
39
    {
40
        $this->Optional = $Optional ?? false;
41
    }
42
}
43