TrackManiaControl/application/core/Utils/CommandLineHelper.php
Steffen Schröder 935b69a416 minor changes
2014-06-26 11:07:53 +02:00

39 lines
753 B
PHP

<?php
namespace ManiaControl\Utils;
/**
* Command Line Helper Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class CommandLineHelper {
/**
* Get the Command Line Parameter 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);
if (count($parts) < 2) {
continue;
}
if ($parts[0] !== $paramName) {
continue;
}
return $parts[1];
}
return null;
}
}