Completed
Pull Request — master (#453)
by Marco
220:48 queued 199:45
created

SignatureGenerator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 2
dl 0
loc 30
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManager\Signature;
6
7
use ProxyManager\Inflector\Util\ParameterEncoder;
8
use ProxyManager\Inflector\Util\ParameterHasher;
9
10
/**
11
 * {@inheritDoc}
12
 */
13
final class SignatureGenerator implements SignatureGeneratorInterface
14
{
15
    private ParameterEncoder $parameterEncoder;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
16
    private ParameterHasher $parameterHasher;
17
18
    public function __construct()
19
    {
20
        $this->parameterEncoder = new ParameterEncoder();
21
        $this->parameterHasher  = new ParameterHasher();
22 10
    }
23
24 10
    /**
25 10
     * {@inheritDoc}
26 10
     */
27
    public function generateSignature(array $parameters) : string
28
    {
29
        return $this->parameterEncoder->encodeParameters($parameters);
30
    }
31 5
32
    /**
33 5
     * {@inheritDoc}
34
     */
35
    public function generateSignatureKey(array $parameters) : string
36
    {
37
        return $this->parameterHasher->hashParameters($parameters);
38
    }
39
}
40