Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public static function getHomePath(): Directory |
||
28 | { |
||
29 | $unixHome = getenv('HOME'); |
||
30 | |||
31 | if (!empty($unixHome)) { |
||
32 | return new Directory($unixHome); |
||
33 | } |
||
34 | |||
35 | $windowsHome = getenv('USERPROFILE'); |
||
36 | if (!empty($windowsHome)) { |
||
37 | return new Directory($windowsHome); |
||
38 | } |
||
39 | |||
40 | $windowsHome = getenv('HOMEPATH'); |
||
41 | if (!empty($windowsHome)) { |
||
42 | return new Directory(getenv('HOMEDRIVE') . getenv('HOMEPATH')); |
||
43 | } |
||
44 | |||
45 | throw new Exception('Could not get the users\'s home path'); |
||
46 | } |
||
48 |