Lines Matching +full:ini +full:- +full:values
10 * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
47 * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
56 * An array of all values specified on the command line.
60 protected $values = array(); variable in PHP_CodeSniffer_CLI
112 $this->checkRequirements();
113 $numErrors = $this->process();
141 $this->checkRequirements();
143 $this->dieOnUnknownArg = false;
146 $cliValues = $this->getCommandLineValues();
162 if (isset($cliValues['no-patch']) === true || empty($cliValues['files']) === true) {
170 $diffFile = getcwd().'/phpcbf-fixed.diff';
179 $cliValues['phpcbf-suffix'] = $suffix;
182 $numErrors = $this->process($cliValues);
205 $cmd = "patch -p0 -ui \"$diffFile\"";
269 * Get a list of default values for all possible command line arguments.
279 // The default values for config settings.
315 $defaults['encoding'] = 'iso-8859-1';
346 $defaults['reportWidth'] = $this->_validateReportWidth($reportWidth);
387 * Gets the processed command line values.
389 * If the values have not yet been set, the values will be sourced
396 if (empty($this->values) === false) {
397 return $this->values;
403 $this->setCommandLineValues($args);
417 $this->values['stdin'] = $fileContents;
421 return $this->values;
427 * Set the command line values.
436 $this->values = array(
440 } else if (empty($this->values) === true) {
441 $this->values = $this->getDefaults();
444 $this->_cliArgs = $args;
448 $arg = $this->_cliArgs[$i];
453 if ($arg{0} === '-') {
454 if ($arg === '-' || $arg === '--') {
459 if ($arg{1} === '-') {
460 $this->processLongArgument(substr($arg, 2), $i);
464 if ($switch === '-') {
468 $this->processShortArgument($switch, $i);
472 $this->processUnknownArgument($arg, $i);
480 * Processes a short (-e) command line argument.
492 $this->printUsage();
495 $this->printInstalledStandards();
498 if ($this->values['quiet'] === true) {
503 if (isset($this->values['verbosity']) === false) {
504 $this->values['verbosity'] = 1;
506 $this->values['verbosity']++;
510 $this->values['local'] = true;
513 $this->values['showSources'] = true;
516 $this->values['interactive'] = true;
519 $this->values['explain'] = true;
522 if ($this->values['quiet'] === true) {
527 $this->values['showProgress'] = true;
531 $this->values['quiet'] = true;
532 $this->values['showProgress'] = false;
533 $this->values['verbosity'] = 0;
536 $ini = explode('=', $this->_cliArgs[($pos + 1)]);
537 $this->_cliArgs[($pos + 1)] = '';
538 if (isset($ini[1]) === true) {
539 ini_set($ini[0], $ini[1]);
541 ini_set($ini[0], true);
545 $this->values['warningSeverity'] = 0;
548 $this->values['warningSeverity'] = null;
551 if ($this->dieOnUnknownArg === false) {
552 $this->values[$arg] = $arg;
554 $this->processUnknownArgument('-'.$arg, $pos);
562 * Processes a long (--example) command line argument.
573 $this->printUsage();
580 $this->values['colors'] = true;
582 case 'no-colors':
583 $this->values['colors'] = false;
585 case 'config-set':
586 if (isset($this->_cliArgs[($pos + 1)]) === false
587 || isset($this->_cliArgs[($pos + 2)]) === false
590 $this->printUsage();
594 $key = $this->_cliArgs[($pos + 1)];
595 $value = $this->_cliArgs[($pos + 2)];
601 echo $e->getMessage().PHP_EOL;
611 case 'config-delete':
612 if (isset($this->_cliArgs[($pos + 1)]) === false) {
614 $this->printUsage();
618 $key = $this->_cliArgs[($pos + 1)];
626 echo $e->getMessage().PHP_EOL;
633 case 'config-show':
635 $this->printConfigData($data);
637 case 'runtime-set':
638 if (isset($this->_cliArgs[($pos + 1)]) === false
639 || isset($this->_cliArgs[($pos + 2)]) === false
642 $this->printUsage();
646 $key = $this->_cliArgs[($pos + 1)];
647 $value = $this->_cliArgs[($pos + 2)];
648 $this->_cliArgs[($pos + 1)] = '';
649 $this->_cliArgs[($pos + 2)] = '';
658 $this->printUsage();
663 $this->values['sniffs'] = $sniffs;
669 $this->printUsage();
674 $this->values['exclude'] = $sniffs;
681 $this->printUsage();
685 $this->values['bootstrap'][] = $path;
687 } else if (substr($arg, 0, 10) === 'file-list=') {
692 $this->printUsage();
708 $this->printUsage();
712 $this->values['files'][] = $realFile;
714 } else if (substr($arg, 0, 11) === 'stdin-path=') {
715 $this->values['stdinPath'] = PHP_CodeSniffer::realpath(substr($arg, 11));
718 if ($this->values['stdinPath'] === false) {
719 $this->values['stdinPath'] = trim(substr($arg, 11));
721 } else if (substr($arg, 0, 12) === 'report-file=') {
722 $this->values['reportFile'] = PHP_CodeSniffer::realpath(substr($arg, 12));
725 if ($this->values['reportFile'] === false) {
726 $this->values['reportFile'] = substr($arg, 12);
728 $dir = dirname($this->values['reportFile']);
730 …echo 'ERROR: The specified report file path "'.$this->values['reportFile'].'" points to a non-exis…
731 $this->printUsage();
737 … $this->values['reportFile'] = getcwd().'/'.basename($this->values['reportFile']);
748 … $this->values['reportFile'] = $dir.'/'.basename($this->values['reportFile']);
753 if (is_dir($this->values['reportFile']) === true) {
754 …echo 'ERROR: The specified report file path "'.$this->values['reportFile'].'" is a directory'.PHP_…
755 $this->printUsage();
758 } else if (substr($arg, 0, 13) === 'report-width=') {
759 $this->values['reportWidth'] = $this->_validateReportWidth(substr($arg, 13));
761 || substr($arg, 0, 7) === 'report-'
763 if ($arg[6] === '-') {
770 $report = substr($arg, 7, ($split - 7));
800 $this->values['reports'][$report] = $output;
804 $this->values['standard'] = explode(',', $standards);
807 if (isset($this->values['extensions']) === false) {
808 $this->values['extensions'] = array();
811 …$this->values['extensions'] = array_merge($this->values['extensions'], explode(',', substr($arg, 1…
813 $this->values['errorSeverity'] = (int) substr($arg, 9);
814 $this->values['warningSeverity'] = $this->values['errorSeverity'];
815 } else if (substr($arg, 0, 15) === 'error-severity=') {
816 $this->values['errorSeverity'] = (int) substr($arg, 15);
817 } else if (substr($arg, 0, 17) === 'warning-severity=') {
818 $this->values['warningSeverity'] = (int) substr($arg, 17);
832 $this->values['ignored'][$pattern] = 'absolute';
835 $this->values['generator'] = substr($arg, 10);
837 $this->values['encoding'] = strtolower(substr($arg, 9));
838 } else if (substr($arg, 0, 10) === 'tab-width=') {
839 $this->values['tabWidth'] = (int) substr($arg, 10);
841 if ($this->dieOnUnknownArg === false) {
844 $this->values[$arg] = $arg;
848 $this->values[$arg] = $value;
851 $this->processUnknownArgument('--'.$arg, $pos);
874 if ($arg{0} === '-') {
875 if ($this->dieOnUnknownArg === false) {
880 $this->printUsage();
886 if ($this->dieOnUnknownArg === false) {
891 $this->printUsage();
894 $this->values['files'][] = $file;
903 * @param array $values An array of values determined from CLI args.
908 public function process($values=array()) argument
910 if (empty($values) === true) {
911 $values = $this->getCommandLineValues();
913 $values = array_merge($this->getDefaults(), $values);
914 $this->values = $values;
917 if ($values['generator'] !== '') {
918 $phpcs = new PHP_CodeSniffer($values['verbosity']);
919 if ($values['standard'] === null) {
920 $values['standard'] = $this->validateStandard(null);
923 foreach ($values['standard'] as $standard) {
924 $phpcs->generateDocs(
926 $values['sniffs'],
927 $values['generator']
935 $values['standard'] = $this->validateStandard($values['standard']);
936 foreach ($values['standard'] as $standard) {
941 $this->printInstalledStandards();
946 if ($values['explain'] === true) {
947 foreach ($values['standard'] as $standard) {
948 $this->explainStandard($standard);
954 $phpcs = new PHP_CodeSniffer($values['verbosity'], null, null, null);
955 $phpcs->setCli($this);
956 $phpcs->initStandard($values['standard'], $values['sniffs'], $values['exclude']);
957 $values = $this->values;
959 $phpcs->setTabWidth($values['tabWidth']);
960 $phpcs->setEncoding($values['encoding']);
961 $phpcs->setInteractive($values['interactive']);
965 if (empty($values['extensions']) === false) {
966 $phpcs->setAllowedFileExtensions($values['extensions']);
970 if (empty($values['ignored']) === false) {
971 $ignorePatterns = array_merge($phpcs->getIgnorePatterns(), $values['ignored']);
972 $phpcs->setIgnorePatterns($ignorePatterns);
976 if ($values['errorSeverity'] === null) {
977 $this->errorSeverity = PHPCS_DEFAULT_ERROR_SEV;
979 $this->errorSeverity = $values['errorSeverity'];
982 if ($values['warningSeverity'] === null) {
983 $this->warningSeverity = PHPCS_DEFAULT_WARN_SEV;
985 $this->warningSeverity = $values['warningSeverity'];
988 if (empty($values['reports']) === true) {
989 $values['reports']['full'] = $values['reportFile'];
990 $this->values['reports'] = $values['reports'];
994 foreach ($values['bootstrap'] as $bootstrap) {
998 $phpcs->processFiles($values['files'], $values['local']);
1000 if (empty($values['files']) === true || $values['stdin'] !== null) {
1001 $fileContents = $values['stdin'];
1013 $this->printUsage();
1016 $this->values['stdin'] = $fileContents;
1017 $phpcs->processFile('STDIN', $fileContents);
1024 if ($values['interactive'] === true) {
1028 return $this->printErrorReport(
1030 $values['reports'],
1031 $values['showSources'],
1032 $values['reportFile'],
1033 $values['reportWidth']
1082 $result = $phpcs->reporting->printReport(
1085 $this->values,
1101 || (($errors + $warnings) === 0 && $this->values['showProgress'] === true))
1115 $return -= $errors;
1122 $return -= $warnings;
1134 * Checks things like default values and case.
1203 $phpcs->process(array(), $standard);
1204 $sniffs = $phpcs->getSniffs();
1230 echo str_repeat('-', (strlen($lastStandard.$lastCount) + 10));
1240 echo ' '.$parts[0].'.'.$parts[2].'.'.substr($parts[3], 0, -5).PHP_EOL;
1288 $this->printPHPCBFUsage();
1290 $this->printPHPCSUsage();
1303 …echo 'Usage: phpcs [-nwlsaepqvi] [-d key[=value]] [--colors] [--no-colors] [--stdin-path=<stdinPat…
1304 …echo ' [--report=<report>] [--report-file=<reportFile>] [--report-<report>=<reportFile>] ...'.P…
1305 …echo ' [--report-width=<reportWidth>] [--generator=<generator>] [--tab-width=<tabWidth>]'.PHP_E…
1306 …echo ' [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>]'.P…
1307 …echo ' [--runtime-set key value] [--config-set key value] [--config-delete key] [--config-show]…
1308 …echo ' [--standard=<standard>] [--sniffs=<sniffs>] [--exclude=<sniffs>] [--encoding=<encoding>]…
1309 … echo ' [--extensions=<extensions>] [--ignore=<patterns>] [--bootstrap=<bootstrap>]'.PHP_EOL;
1310 echo ' [--file-list=<fileList>] <file> ...'.PHP_EOL;
1311 echo ' Set runtime value (see --config-set) '.PHP_EOL;
1312 … echo ' -n Do not print warnings (shortcut for --warning-severity=0)'.PHP_EOL;
1313 echo ' -w Print both warnings and errors (this is the default)'.PHP_EOL;
1314 echo ' -l Local directory only, no recursion'.PHP_EOL;
1315 echo ' -s Show sniff codes in all reports'.PHP_EOL;
1316 echo ' -a Run interactively'.PHP_EOL;
1317 echo ' -e Explain a standard by showing the sniffs it includes'.PHP_EOL;
1318 echo ' -p Show progress of the run'.PHP_EOL;
1319 echo ' -q Quiet mode; disables progress and verbose output'.PHP_EOL;
1320 echo ' -v[v][v] Print verbose output'.PHP_EOL;
1321 echo ' -i Show a list of installed coding standards'.PHP_EOL;
1322 …echo ' -d Set the [key] php.ini value to [value] or [true] if value is omitted'.…
1323 echo ' --help Print this help message'.PHP_EOL;
1324 echo ' --version Print version information'.PHP_EOL;
1325 echo ' --colors Use colors in output'.PHP_EOL;
1326 echo ' --no-colors Do not use colors in output (this is the default)'.PHP_EOL;
1331 …echo ' <encoding> The encoding of the files being checked (default is iso-8859-1)'.PHP_E…
1362 echo 'Usage: phpcbf [-nwli] [-d key[=value]] [--stdin-path=<stdinPath>]'.PHP_EOL;
1363 …echo ' [--standard=<standard>] [--sniffs=<sniffs>] [--exclude=<sniffs>] [--suffix=<suffix>]'.PH…
1364 …echo ' [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>]'.P…
1365 echo ' [--tab-width=<tabWidth>] [--encoding=<encoding>]'.PHP_EOL;
1366 … echo ' [--extensions=<extensions>] [--ignore=<patterns>] [--bootstrap=<bootstrap>]'.PHP_EOL;
1367 echo ' [--file-list=<fileList>] <file> ...'.PHP_EOL;
1368 … echo ' -n Do not fix warnings (shortcut for --warning-severity=0)'.PHP_EOL;
1369 echo ' -w Fix both warnings and errors (on by default)'.PHP_EOL;
1370 echo ' -l Local directory only, no recursion'.PHP_EOL;
1371 echo ' -i Show a list of installed coding standards'.PHP_EOL;
1372 …echo ' -d Set the [key] php.ini value to [value] or [true] if value is omitted'.…
1373 echo ' --help Print this help message'.PHP_EOL;
1374 echo ' --version Print version information'.PHP_EOL;
1375 echo ' --no-patch Do not make use of the "diff" or "patch" programs'.PHP_EOL;
1380 …echo ' <encoding> The encoding of the files being fixed (default is iso-8859-1)'.PHP_EOL;