Completed
Push — master ( edf7d0...ba16ca )
by Tony Karavasilev (Тони
19:42
created

getKeyedDigestionFunction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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 10
    public function setKeyedDigestionFunction(KeyedHashFunction $hasher)
33
    {
34 10
        $this->keyedDigestionSource = $hasher;
35
36 10
        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 6
    public function getKeyedDigestionFunction()
45
    {
46 6
        return $this->keyedDigestionSource;
47
    }
48
}
49