function Config::setCommandLineValues
Set the command line values.
Parameters
array $args An array of command line arguments to set.:
Return value
void
1 call to Config::setCommandLineValues()
- Config::__construct in vendor/
squizlabs/ php_codesniffer/ src/ Config.php - Creates a Config object and populates it with command line values.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Config.php, line 463
Class
- Config
- Stores the configuration used to run PHPCS and PHPCBF.
Namespace
PHP_CodeSnifferCode
public function setCommandLineValues($args) {
$this->cliArgs = $args;
$numArgs = count($args);
for ($i = 0; $i < $numArgs; $i++) {
$arg = $this->cliArgs[$i];
if ($arg === '') {
continue;
}
if ($arg[0] === '-') {
if ($arg === '-') {
// Asking to read from STDIN.
$this->stdin = true;
self::$overriddenDefaults['stdin'] = true;
continue;
}
if ($arg === '--') {
// Empty argument, ignore it.
continue;
}
if ($arg[1] === '-') {
$this->processLongArgument(substr($arg, 2), $i);
}
else {
$switches = str_split($arg);
foreach ($switches as $switch) {
if ($switch === '-') {
continue;
}
$this->processShortArgument($switch, $i);
}
}
}
else {
$this->processUnknownArgument($arg, $i);
}
//end if
}
//end for
}