| Conditions | 1 |
| Paths | 1 |
| Total Lines | 8 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | function get_branch_name(): string |
||
| 37 | { |
||
| 38 | $stringfromfile = file('.git/HEAD', FILE_USE_INCLUDE_PATH); |
||
| 39 | $firstLine = $stringfromfile[0]; //get the string from the array |
||
| 40 | $explodedstring = explode("/", $firstLine, 3); //seperate out by the "/" in the string |
||
| 41 | $branchname = $explodedstring[2]; //get the one that is always the branch name |
||
| 42 | |||
| 43 | return $branchname; |
||
| 44 | } |
||
| 47 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.