improved quit and restart coding

This commit is contained in:
Steffen Schröder
2014-08-02 20:51:48 +02:00
parent 297d251586
commit 58a668cf65
3 changed files with 108 additions and 80 deletions

View File

@ -12,19 +12,16 @@ namespace ManiaControl\Utils;
class CommandLineHelper {
/**
* Get the Command Line Parameter with the given Name
* Get the command line parameter value with the given name
*
* @param string $paramName
* @return string
*/
public static function getParameter($paramName) {
global $argv;
if (!is_array($argv)) {
return null;
}
$paramName = (string)$paramName;
foreach ($argv as $arg) {
$parts = explode('=', $arg, 2);
$params = self::getAllParameters();
foreach ($params as $param) {
$parts = explode('=', $param, 2);
if (count($parts) < 2) {
continue;
}
@ -35,4 +32,14 @@ class CommandLineHelper {
}
return null;
}
/**
* Get all command line parameters
*
* @return array
*/
public static function getAllParameters() {
global $argv;
return (array)$argv;
}
}