Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
17 | 21 | static function normalize($type, $contextClass=null){ |
|
|
|||
18 | 21 | $resolver = new TypeResolver(); |
|
19 | 21 | $context = null; |
|
20 | 21 | if($contextClass){ |
|
21 | //TODO 优化性能 |
||
22 | 21 | $contextFactory = new ContextFactory(); |
|
23 | 21 | $context = $contextFactory->createFromReflector(new \ReflectionClass($contextClass)); |
|
24 | 21 | } |
|
25 | 21 | $type = $resolver->resolve($type, $context); |
|
26 | 21 | $type = ltrim($type, '\\'); |
|
27 | 21 | return (string)$type; |
|
28 | } |
||
29 | /** |
||
63 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.