Completed
Pull Request — master (#2069)
by Andreas
24:59
created

ProxyManagerClassNameResolver::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ODM\MongoDB\Proxy\Resolver;
6
7
use Doctrine\ODM\MongoDB\Configuration;
8
use ProxyManager\Inflector\ClassNameInflectorInterface;
9
10
/**
11
 * @internal
12
 */
13
final class ProxyManagerClassNameResolver implements ClassNameResolver
14
{
15
    /** @var Configuration */
16
    private $configuration;
17
18
    public function __construct(Configuration $configuration)
19
    {
20
        $this->configuration = $configuration;
21
    }
22
23
    /**
24
     * Gets the real class name of a class name that could be a proxy.
25
     */
26
    public function getRealClass(string $class) : string
27
    {
28
        return $this->getClassNameInflector()->getUserClassName($class);
29
    }
30
31
    private function getClassNameInflector() : ClassNameInflectorInterface
32
    {
33
        return $this->configuration->getProxyManagerConfiguration()->getClassNameInflector();
34
    }
35
}
36