Failed Conditions
Push — master ( 148895...b07393 )
by Guilherme
09:59
created

StaticReflectionService::getClassNamespace()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 9
ccs 0
cts 5
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ORM\Reflection;
6
7
use ReflectionClass;
8
use ReflectionProperty;
9
use function strpos;
10
use function strrev;
11
use function strrpos;
12
use function substr;
13
14
/**
15
 * PHP Runtime Reflection Service.
16
 */
17
class StaticReflectionService implements ReflectionService
18
{
19
    /**
20
     * {@inheritDoc}
21
     */
22
    public function getParentClasses(string $className) : array
23
    {
24
        return [];
25
    }
26
27
    /**
28
     * {@inheritDoc}
29
     */
30
    public function getClassShortName(string $className) : string
31
    {
32
        if (strpos($className, '\\') !== false) {
33
            $className = substr($className, strrpos($className, '\\')+1);
34
        }
35
36
        return $className;
37
    }
38
39
    /**
40
     * {@inheritDoc}
41
     */
42
    public function getClassNamespace(string $className) : string
43
    {
44
        $namespace = '';
45
46
        if (strpos($className, '\\') !== false) {
47
            $namespace = strrev(substr(strrev($className), strpos(strrev($className), '\\')+1));
48
        }
49
50
        return $namespace;
51
    }
52
53
    /**
54
     * {@inheritDoc}
55
     */
56
    public function getClass(string $className) : ?ReflectionClass
57
    {
58
        return null;
59
    }
60
61
    /**
62
     * {@inheritDoc}
63
     */
64
    public function getAccessibleProperty(string $className, string $propertyName) : ?ReflectionProperty
65
    {
66
        return null;
67
    }
68
69
    /**
70
     * {@inheritDoc}
71
     */
72
    public function hasPublicMethod(string $className, string $methodName) : bool
73
    {
74
        return true;
75
    }
76
}
77