KeyBuilder::prefix()   A
last analyzed

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 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author enea dhack <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Enea\Authorization\Drivers\Cache;
13
14
use Enea\Authorization\Contracts\Owner;
15
16
class KeyBuilder
17
{
18
    public const HASH = 'crc32b';
19
20 58
    public function make(Owner $owner): string
21
    {
22 58
        return "{$this->prefix($owner)}.{$owner->getIdentificationKey()}";
23
    }
24
25 58
    private function prefix(Owner $owner): string
26
    {
27 58
        return hash(self::HASH, get_class($owner));
28
    }
29
}
30