| Total Complexity | 4 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | trait FunctionTrait |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Get a function name. |
||
| 16 | * |
||
| 17 | * @param File $file |
||
| 18 | * @param int $functionIndex |
||
| 19 | * |
||
| 20 | * @return bool|string |
||
| 21 | */ |
||
| 22 | protected function getFunctionName(File $file, $functionIndex) |
||
| 23 | { |
||
| 24 | $index = $this->findFunctionNameIndex($file, $functionIndex); |
||
| 25 | return $index |
||
| 26 | ? $file->getTokens()[$index]['content'] |
||
| 27 | : false; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Find the function name index. |
||
| 32 | * |
||
| 33 | * @param File $file |
||
| 34 | * @param int $functionIndex |
||
| 35 | * |
||
| 36 | * @return bool|int |
||
| 37 | */ |
||
| 38 | protected function findFunctionNameIndex(File $file, $functionIndex) |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Find the start of a function body. |
||
| 45 | * |
||
| 46 | * @param File $file |
||
| 47 | * @param int $functionIndex |
||
| 48 | * |
||
| 49 | * @return bool|int |
||
| 50 | */ |
||
| 51 | protected function findFunctionBodyStartIndex(File $file, $functionIndex) |
||
| 56 |