Passed
Push — master ( e9ba59...c2c890 )
by Tony Karavasilev (Тони
19:20
created

KeyExpansionInjectableTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 24
ccs 0
cts 8
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setKeyExpansionFunction() 0 5 1
A getKeyExpansionFunction() 0 3 1
1
<?php
2
3
/**
4
 * Trait implementation of the setter dependency injection type for key expansion digestion services.
5
 */
6
7
namespace CryptoManana\Core\Traits\Containers;
8
9
use \CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyMaterialDerivationFunction as KeyDerivationFunction;
10
use \CryptoManana\Core\Interfaces\Containers\KeyExpansionInjectableInterface as KeyExpansionSpecification;
11
12
/**
13
 * Trait KeyExpansionInjectableTrait - Reusable implementation of `KeyExpansionInjectableInterface`.
14
 *
15
 * @see \CryptoManana\Core\Interfaces\Containers\KeyExpansionInjectableInterface The abstract specification.
16
 *
17
 * @package CryptoManana\Core\Traits\Containers
18
 *
19
 * @property KeyDerivationFunction|null $keyExpansionSource The message key expansion derivation service.
20
 *
21
 * @mixin KeyExpansionSpecification
22
 */
23
trait KeyExpansionInjectableTrait
24
{
25
    /**
26
     * Setter for the key expansion derivation service.
27
     *
28
     * @param KeyDerivationFunction $hasher The key expansion derivation service or null.
29
     *
30
     * @return $this The container object.
31
     */
32
    public function setKeyExpansionFunction(KeyDerivationFunction $hasher)
33
    {
34
        $this->keyExpansionSource = $hasher;
35
36
        return $this;
37
    }
38
39
    /**
40
     * Getter for the key expansion derivation service.
41
     *
42
     * @return KeyDerivationFunction|null The currently injected key expansion derivation service or null.
43
     */
44
    public function getKeyExpansionFunction()
45
    {
46
        return $this->keyExpansionSource;
47
    }
48
}
49