ClassNameInflector::getUserClassName()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 8
rs 9.4286
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of Sulu.
5
 *
6
 * (c) MASSIVE ART WebServices GmbH
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Sulu\Component\DocumentManager;
13
14
use ProxyManager\Inflector\ClassNameInflector as ProxyManagerClassNameInflector;
15
16
/**
17
 * This is a hack to statically use the ClassNameInflector to
18
 * retrieve the "real" class names for proxy objects.
19
 *
20
 * TODO: This should be a service dependency not a static class
21
 */
22
class ClassNameInflector
23
{
24
    /**
25
     * @var ProxyManagerClassNameInflector
26
     */
27
    public static $inflector;
28
29
    /**
30
     * Return the "real" class name if the given class name is a proxy
31
     * class name.
32
     *
33
     * @param string $className
34
     *
35
     * @return string
36
     */
37
    public static function getUserClassName($className)
38
    {
39
        if (null === self::$inflector) {
40
            static::$inflector = new ProxyManagerClassNameInflector('');
41
        }
42
43
        return static::$inflector->getUserClassName($className);
44
    }
45
}
46