Conditions | 6 |
Paths | 6 |
Total Lines | 42 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public function collect($tokens) |
||
20 | { |
||
21 | $result = []; |
||
22 | foreach ($tokens as $index => $token) |
||
23 | { |
||
24 | // Skip all except double colon |
||
25 | if($token->not(T_DOUBLE_COLON)) |
||
26 | { |
||
27 | continue; |
||
28 | } |
||
29 | $prev = $token->prev(); |
||
30 | $next = $token->next(); |
||
31 | |||
32 | // Should start with class name |
||
33 | if($prev->not(T_STRING)) |
||
34 | { |
||
35 | continue; |
||
36 | } |
||
37 | |||
38 | // Should have method name |
||
39 | if($next->not(T_STRING)) |
||
40 | { |
||
41 | continue; |
||
42 | } |
||
43 | |||
44 | $finishing = $next->next(); |
||
45 | |||
46 | // Should have opening bracket after method name |
||
47 | if($finishing->value !== '(') |
||
48 | { |
||
49 | continue; |
||
50 | } |
||
51 | |||
52 | // TODO Resolve use statements |
||
53 | $className = $prev->value; |
||
54 | |||
55 | $methodName = $next->value; |
||
56 | $name = sprintf('%s::%s', $className, $methodName); |
||
57 | |||
58 | $result[] = new StaticMethod($name,$tokens, $index); |
||
59 | } |
||
60 | return $result; |
||
61 | } |
||
63 | } |