Passed
Push — master ( 75042c...b194e9 )
by Valentin
06:01
created

Names   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 11 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Cycle\ORM\Promise;
5
6
class Names
7
{
8
    public function make(\ReflectionClass $reflection, ?string $namespace = null): string
9
    {
10
        $hash = hash('sha256', $reflection->getName() . $reflection->getFileName());
0 ignored issues
show
Bug introduced by
Consider using $reflection->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
11
12
        $name = "{$reflection->getShortName()}_$hash";
13
        if ($namespace !== null) {
14
            return "$namespace\\$name";
15
        }
16
17
        return $name;
18
    }
19
}