Conditions | 5 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | public static function setupHome($home) |
||
38 | { |
||
39 | if (empty($home)) { |
||
40 | throw new \InvalidArgumentException('Empty home directory encountered.'); |
||
41 | } |
||
42 | |||
43 | if (false === getenv('COMPOSER')) { |
||
44 | putenv('COMPOSER=' . $home . DIRECTORY_SEPARATOR . 'composer.json'); |
||
45 | } |
||
46 | chdir($home); |
||
47 | |||
48 | // Ensure at least one of the environment variables is available. |
||
49 | if (!getenv('COMPOSER_HOME') && !getenv('HOME')) { |
||
50 | putenv('COMPOSER_HOME=' . $home); |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 |