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

HMACOutputLengthValue::validateValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Type;
6
7
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
8
use SimpleSAML\XMLSchema\Type\IntegerValue;
9
use SimpleSAML\XMLSecurity\Assert\Assert;
10
11
/**
12
 * @package simplesaml/xml-security
13
 */
14
class HMACOutputLengthValue extends IntegerValue
15
{
16
    /**
17
     * Validate the value.
18
     *
19
     * @param string $value
20
     * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
21
     * @throws \SimpleSAML\XMLSecurity\Exception\ProtocolViolationException when not devisible by 8
22
     * @return void
23
     */
24
    protected function validateValue(string $value): void
25
    {
26
        // Note: value must already be sanitized before validating
27
        Assert::validHMACOutputLength($this->sanitizeValue($value), SchemaViolationException::class);
28
    }
29
}
30