protected function parseArguments()
{
if (!isset($_SERVER['argv'])) {
if (false === (bool) ini_get('register_argc_argv')) {
// @codeCoverageIgnoreStart
echo 'Please enable register_argc_argv in your php.ini.';
} else {
// @codeCoverageIgnoreEnd
echo 'Unknown error, no $argv array available.';
}
echo PHP_EOL, PHP_EOL;
return false;
}
$argv = $_SERVER['argv'];
// Remove the pdepend command line file
array_shift($argv);
if (count($argv) === 0) {
return false;
}
// Last argument must be a list of source directories
if (strpos(end($argv), '--') !== 0) {
$this->source = explode(',', array_pop($argv));
}
for ($i = 0, $c = count($argv); $i < $c; ++$i) {
// Is it an ini_set option?
if ($argv[$i] === '-d' && isset($argv[$i + 1])) {
if (strpos($argv[++$i], '=') === false) {
ini_set($argv[$i], 'on');
} else {
list($key, $value) = explode('=', $argv[$i]);
ini_set($key, $value);
}
} elseif (strpos($argv[$i], '=') === false) {
$this->options[$argv[$i]] = true;
} else {
list($key, $value) = explode('=', $argv[$i]);
$this->options[$key] = $value;
}
}
return true;
}