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

KeyedDigestionInjectableTrait   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 setKeyedDigestionFunction() 0 5 1
A getKeyedDigestionFunction() 0 3 1
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