Conditions | 9 |
Paths | 6 |
Total Lines | 42 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
26 | $functions = array(); |
||
27 | |||
28 | for ($k = 0; $k < $count; ++$k) { |
||
29 | $value = $this->tokens[$k]; |
||
30 | |||
31 | //close the current function |
||
32 | if (is_string($value)) { |
||
33 | if ($value === ')' && isset($bufferFunctions[0])) { |
||
34 | $functions[] = array_shift($bufferFunctions); |
||
35 | } |
||
36 | |||
37 | continue; |
||
38 | } |
||
39 | |||
40 | //add an argument to the current function |
||
41 | if (isset($bufferFunctions[0]) && ($value[0] === T_CONSTANT_ENCAPSED_STRING)) { |
||
42 | $bufferFunctions[0][2][] = Strings::fromPhp($value[1]); |
||
43 | continue; |
||
44 | } |
||
45 | |||
46 | //new function found |
||
47 | if (($value[0] === T_STRING) && is_string($this->tokens[$k + 1]) && ($this->tokens[$k + 1] === '(')) { |
||
48 | array_unshift($bufferFunctions, array($value[1], $value[2], array())); |
||
49 | ++$k; |
||
50 | |||
51 | continue; |
||
52 | } |
||
53 | } |
||
54 | |||
55 | return $functions; |
||
56 | } |
||
57 | } |
||
58 |