| Conditions | 4 | 
| Paths | 8 | 
| Total Lines | 17 | 
| Code Lines | 12 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 0 | 
| CRAP Score | 20 | 
| Changes | 2 | ||
| Bugs | 1 | Features | 1 | 
| 1 | <?php | ||
| 11 | public function executeCommand($scriptPath, array $env) | ||
| 12 | 	{ | ||
| 13 | $oldCwd = NULL; | ||
| 14 | 		if (is_array($scriptPath)) { | ||
| 15 | $cwd = $scriptPath['cwd']; | ||
| 16 | $scriptPath = $scriptPath['command']; | ||
| 17 | $oldCwd = getcwd(); | ||
| 18 | chdir($cwd); | ||
| 19 | } | ||
| 20 | 		foreach ($env as $key => $value) { | ||
| 21 | putenv($key . '=' . $value); | ||
| 22 | } | ||
| 23 | shell_exec($scriptPath); | ||
| 24 | 		if ($oldCwd !== NULL) { | ||
| 25 | chdir($oldCwd); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | |||
| 30 |