Minor refactoring to `XdebugHandler@check` #5669

Merged
merged 1 commit into from Sep 12, 2016

Minor refactoring - Early exit

commit 6990454e567a860411931135a838cf1f838cb49c @kamranahmedse kamranahmedse committed Sep 12, 2016
@@ -50,21 +50,18 @@ public function __construct(OutputInterface $output)
*/
public function check()
{
- if (!$this->needsRestart()) {
- $originalIniScanDir = getenv(self::ENV_INI_SCAN_DIR_OLD);
-
- if ($originalIniScanDir) {
- putenv(self::ENV_INI_SCAN_DIR_OLD);
- putenv(self::ENV_INI_SCAN_DIR.'=' . $originalIniScanDir);
- } else {
- putenv(self::ENV_INI_SCAN_DIR);
- }
-
+ if ($this->needsRestart()) {
+ $this->prepareRestart($command) && $this->restart($command);
return;
}
- if ($this->prepareRestart($command)) {
- $this->restart($command);
+ $originalIniScanDir = getenv(self::ENV_INI_SCAN_DIR_OLD);
+
+ if ($originalIniScanDir) {
+ putenv(self::ENV_INI_SCAN_DIR_OLD);
+ putenv(self::ENV_INI_SCAN_DIR . '=' . $originalIniScanDir);
+ } else {
+ putenv(self::ENV_INI_SCAN_DIR);
}
}