Passed
Push — master ( dd2d9f...8460b0 )
by Tim
13:58
created

C14N::withoutComments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Alg;
6
7
/**
8
 * Canonicalization algorithms
9
 */
10
enum C14N: string
11
{
12
    case INCLUSIVE_WITH_COMMENTS = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments';
13
    case INCLUSIVE_WITHOUT_COMMENTS = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315';
14
    case EXCLUSIVE_WITH_COMMENTS = 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments';
15
    case EXCLUSIVE_WITHOUT_COMMENTS = 'http://www.w3.org/2001/10/xml-exc-c14n#';
16
17
    /**
18
     * @return bool
19
     */
20
    public function withComments(): bool
21
    {
22
        return match ($this) {
23
            C14N::INCLUSIVE_WITH_COMMENTS, C14N::EXCLUSIVE_WITH_COMMENTS => true,
24
            default => false,
25
        };
26
    }
27
28
29
    /**
30
     * @return bool
31
     */
32
    public function withoutComments(): bool
33
    {
34
        return match ($this) {
35
            C14N::INCLUSIVE_WITHOUT_COMMENTS, C14N::EXCLUSIVE_WITHOUT_COMMENTS => true,
36
            default => false,
37
        };
38
    }
39
40
41
    /**
42
     * @return bool
43
     */
44
    public function exclusive(): bool
45
    {
46
        return match ($this) {
47
            C14N::EXCLUSIVE_WITH_COMMENTS, C14N::EXCLUSIVE_WITHOUT_COMMENTS => true,
48
            default => false,
49
        };
50
    }
51
52
53
    /**
54
     * @return bool
55
     */
56
    public function inclusive(): bool
57
    {
58
        return match ($this) {
59
            C14N::INCLUSIVE_WITH_COMMENTS, C14N::INCLUSIVE_WITHOUT_COMMENTS => true,
60
            default => false,
61
        };
62
    }
63
}
64