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

setKeyedDigestionFunction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * Trait implementation of the setter dependency injection type for keyed digestion services.
5
 */
6
7
namespace CryptoManana\Core\Traits\Containers;
8
9
use \CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyedHashFunction as KeyedHashFunction;
10
use \CryptoManana\Core\Interfaces\Containers\KeyedDigestionInjectableInterface as KeyedDigestionSpecification;
11
12
/**
13
 * Trait KeyedDigestionInjectableTrait - Reusable implementation of `KeyedDigestionInjectableInterface`.
14
 *
15
 * @see \CryptoManana\Core\Interfaces\Containers\KeyedDigestionInjectableInterface The abstract specification.
16
 *
17
 * @package CryptoManana\Core\Traits\Containers
18
 *
19
 * @property KeyedHashFunction|null $keyedDigestionSource The message keyed digestion service.
20
 *
21
 * @mixin KeyedDigestionSpecification
22
 */
23
trait KeyedDigestionInjectableTrait
24
{
25
    /**
26
     * Setter for the keyed message digestion service.
27
     *
28
     * @param KeyedHashFunction $hasher The keyed message digestion service or null.
29
     *
30
     * @return $this The container object.
31
     */
32
    public function setKeyedDigestionFunction(KeyedHashFunction $hasher)
33
    {
34
        $this->keyedDigestionSource = $hasher;
35
36
        return $this;
37
    }
38
39
    /**
40
     * Getter for the keyed message digestion service.
41
     *
42
     * @return KeyedHashFunction|null The currently injected message digestion service or null.
43
     */
44
    public function getKeyedDigestionFunction()
45
    {
46
        return $this->keyedDigestionSource;
47
    }
48
}
49