Completed
Push — master ( d1a8ba...6150c3 )
by Daniel
12s queued 10s
created

LockIdentifierGenerator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 4
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A generate() 0 5 1
1
<?php
2
3
namespace Jellyfish\LockSymfony;
4
5
use Jellyfish\Lock\LockIdentifierGeneratorInterface;
6
7
class LockIdentifierGenerator implements LockIdentifierGeneratorInterface
8
{
9
    protected const IDENTIFIER_PREFIX = 'lock';
10
11
    /**
12
     * @param array $identifierParts
13
     *
14
     * @return string
15
     */
16
    public function generate(array $identifierParts): string
17
    {
18
        $identifierWithoutPrefix = \sha1(\implode(' ', $identifierParts));
19
20
        return \sprintf('%s:%s', static::IDENTIFIER_PREFIX, $identifierWithoutPrefix);
21
    }
22
}
23