Passed
Pull Request — master (#60)
by Tim
02:20
created

HMACOutputLengthValue   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateValue() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Type;
6
7
use SimpleSAML\XML\Type\IntegerValue;
8
use SimpleSAML\XMLSecurity\Assert\Assert;
9
10
/**
11
 * @package simplesaml/xml-security
12
 */
13
class HMACOutputLengthValue extends IntegerValue
14
{
15
    /**
16
     * Validate the value.
17
     *
18
     * @param string $value
19
     * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
20
     * @throws \SimpleSAML\XMLSecurity\Exception\ProtocolViolationException when not devisible by 8
21
     * @return void
22
     */
23
    protected function validateValue(string $value): void
24
    {
25
        // Note: value must already be sanitized before validating
26
        Assert::validHMACOutputLength($this->sanitizeValue($value));
27
    }
28
}
29