Failed Conditions
Push — ProxyNamingInflector ( 293790 )
by Michael
03:54
created

DefaultProxyNamingInflector   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRealClassName() 0 9 2
1
<?php
2
3
namespace Doctrine\Persistence\Proxy;
4
5
use Doctrine\Common\Persistence\Proxy;
6
use function strrpos;
7
use function substr;
8
9
/**
10
 * @internal Default proxy inflector for 1.x Proxy interface that acts as a polyfill until Persistence 2.0.
11
 */
12
final class DefaultProxyNamingInflector implements ProxyNamingInflector
13
{
14
    /**
15
     * Gets the real class name of a class name that could be a proxy.
16
     */
17 6
    public function getRealClassName(string $className) : string
18
    {
19 6
        $pos = strrpos($className, '\\' . Proxy::MARKER . '\\');
20
21 6
        if ($pos === false) {
22 3
            return $className;
23
        }
24
25 3
        return substr($className, $pos + Proxy::MARKER_LENGTH + 2);
26
    }
27
}
28