unset($params[$key + 1]); } return $value; } if (!($configUrl = extractParams('--config', $dirs))) { $configUrl = 'https://raw.githubusercontent.com/sutunam/mage-patch/master/config.json'; } $patch = new PatchMage($configUrl); if ($su = extractParams('--su', $dirs)) { $patch->setSuUser($su); } if ($sudo = extractParams('--sudo', $dirs)) { $patch->setSudoUser($sudo); } if ($patches = extractParams('--patches', $dirs)) { $patch->setAllowedPatches($patches); } if ($continueOnError = extractParams('--continueOnError', $dirs)) { $patch->setContinueOnError($continueOnError); } if ($dryRun = extractParams('--dryRun', $dirs)) { $patch->setDryRun($dryRun); } if ($kdp = extractParams('--keepDownloadedPatch', $dirs)) { $patch->setKeepDownloadedPatch($kdp); } if ($quiet = extractParams('--quiet', $dirs)) { $patch->setQuiet($quiet); } if (!count($dirs)) { $patch->help();