Total Complexity | 7 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class ReflectionMethodGetter implements GetterInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var ReflectionMethod |
||
17 | */ |
||
18 | private $method; |
||
19 | |||
20 | public function __construct(ReflectionMethod $method) |
||
21 | { |
||
22 | $this->method = $method; |
||
23 | } |
||
24 | |||
25 | public function getName(): string |
||
28 | } |
||
29 | |||
30 | public function getValue($object) |
||
31 | { |
||
32 | return $this->method->invoke($object); |
||
33 | } |
||
34 | |||
35 | public function getPriority(): int |
||
36 | { |
||
37 | $methodName = $this->method->getName(); |
||
38 | // getXXx method |
||
39 | if (strpos($methodName, 'get') === 0) { |
||
40 | return 3; |
||
41 | } |
||
42 | // isXxx method |
||
43 | if (strpos($methodName, 'is') === 0) { |
||
44 | return 2; |
||
45 | } |
||
46 | // hasXxx Method |
||
47 | return 1; |
||
48 | } |
||
49 | |||
50 | public function toType(): ?Type |
||
53 | } |
||
54 | } |
||
55 |