Completed
Pull Request — 1.3.x (#71)
by Grégoire
13:41
created

StaticReflectionService::getAccessibleProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Doctrine\Persistence\Mapping;
4
5
use function strpos;
6
use function strrev;
7
use function strrpos;
8
use function substr;
9
use Doctrine\Persistence\Mapping\ReflectionService;
0 ignored issues
show
Coding Style introduced by
Use statements should be sorted alphabetically. The first wrong one is Doctrine\Persistence\Mapping\ReflectionService.
Loading history...
introduced by
Use Doctrine\Persistence\Mapping\ReflectionService is from the same namespace – that is prohibited.
Loading history...
10
11
/**
12
 * PHP Runtime Reflection Service.
13
 */
14
class StaticReflectionService implements ReflectionService
15
{
16
    /**
17
     * {@inheritDoc}
18
     */
19 1
    public function getParentClasses($class)
20
    {
21 1
        return [];
22
    }
23
24
    /**
25
     * {@inheritDoc}
26
     */
27 1
    public function getClassShortName($className)
28
    {
29 1
        if (strpos($className, '\\') !== false) {
30 1
            $className = substr($className, strrpos($className, '\\') + 1);
31
        }
32 1
        return $className;
33
    }
34
35
    /**
36
     * {@inheritDoc}
37
     */
38 1
    public function getClassNamespace($className)
39
    {
40 1
        $namespace = '';
41 1
        if (strpos($className, '\\') !== false) {
42 1
            $namespace = strrev(substr(strrev($className), strpos(strrev($className), '\\') + 1));
43
        }
44 1
        return $namespace;
45
    }
46
47
    /**
48
     * {@inheritDoc}
49
     */
50 1
    public function getClass($class)
51
    {
52 1
        return null;
53
    }
54
55
    /**
56
     * {@inheritDoc}
57
     */
58 1
    public function getAccessibleProperty($class, $property)
59
    {
60 1
        return null;
61
    }
62
63
    /**
64
     * {@inheritDoc}
65
     */
66 1
    public function hasPublicMethod($class, $method)
67
    {
68 1
        return true;
69
    }
70
}
71