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

LockIdentifierGenerator::generate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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