Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public static function getHomeDir() |
||
32 | { |
||
33 | $home = getenv('SLACK_CLI_HOME'); |
||
34 | if (!$home) { |
||
35 | if (defined('PHP_WINDOWS_VERSION_MAJOR')) { |
||
36 | if (!getenv('APPDATA')) { |
||
37 | throw new \RuntimeException('The APPDATA or SLACK_CLI_HOME environment variable must be set for Slack CLI to run correctly'); |
||
38 | } |
||
39 | $home = strtr(getenv('APPDATA'), '\\', '/') . '/SlackCli'; |
||
40 | } else { |
||
41 | if (!getenv('HOME')) { |
||
42 | throw new \RuntimeException('The HOME or SLACK_CLI_HOME environment variable must be set for Slack CLI to run correctly'); |
||
43 | } |
||
44 | $home = rtrim(getenv('HOME'), '/') . '/.slack-cli'; |
||
45 | } |
||
46 | } |
||
47 | |||
48 | return $home; |
||
49 | } |
||
50 | |||
71 |