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

Names::make()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 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
}