PBES1PKCS5AlgorithmIdentifier::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\PKCS5\ASN1\AlgorithmIdentifier;
6
7
/**
8
 * Base class for PBES1 encryption scheme with PKCS #5 semantics.
9
 */
10
abstract class PBES1PKCS5AlgorithmIdentifier extends PBES1AlgorithmIdentifier
11
{
12
    /**
13
     * Constructor.
14
     *
15
     * @param string $salt            Salt
16
     * @param int    $iteration_count Iteration count
17
     *
18
     * @throws \UnexpectedValueException
19
     */
20 14
    public function __construct(string $salt, int $iteration_count)
21
    {
22 14
        if (8 !== strlen($salt)) {
23 1
            throw new \UnexpectedValueException('Salt length must be 8 octets.');
24
        }
25 13
        parent::__construct($salt, $iteration_count);
26 13
    }
27
}
28