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

VerificationAlgorithmInjectableTrait   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 getVerificationAlgorithm() 0 3 1
A setVerificationAlgorithm() 0 5 1
1
<?php
2
3
/**
4
 * Trait implementation of the setter dependency injection type for verification algorithm services.
5
 */
6
7
namespace CryptoManana\Core\Traits\Containers;
8
9
use \CryptoManana\Core\Abstractions\MessageDigestion\AbstractHashAlgorithm as HashFunction;
10
use \CryptoManana\Core\Interfaces\MessageDigestion\SecureVerificationInterface as VerificationAlgorithm;
11
use \CryptoManana\Core\Interfaces\Containers\VerificationAlgorithmInjectableInterface as VerificationSpecification;
12
13
/**
14
 * Trait VerificationAlgorithmInjectableTrait - Reusable implementation of `VerificationAlgorithmInjectableInterface`.
15
 *
16
 * @see \CryptoManana\Core\Interfaces\Containers\VerificationAlgorithmInjectableInterface The abstract specification.
17
 *
18
 * @package CryptoManana\Core\Traits\Containers
19
 *
20
 * @property HashFunction|VerificationAlgorithm|null $verificationSource The message digestion and verification service.
21
 *
22
 * @mixin VerificationSpecification
23
 */
24
trait VerificationAlgorithmInjectableTrait
25
{
26
    /**
27
     * Setter for the message digestion and verification service.
28
     *
29
     * @param HashFunction|VerificationAlgorithm $hasher The message digestion verification service or null.
30
     *
31
     * @return $this The container object.
32
     */
33
    public function setVerificationAlgorithm(VerificationAlgorithm $hasher)
34
    {
35
        $this->verificationSource = $hasher;
36
37
        return $this;
38
    }
39
40
    /**
41
     * Getter for the message digestion and verification service.
42
     *
43
     * @return HashFunction|VerificationAlgorithm|null The currently injected message digestion service or null.
44
     */
45
    public function getVerificationAlgorithm()
46
    {
47
        return $this->verificationSource;
48
    }
49
}
50