Exemple #1
0
 /**
  * Init the rulesets and other high-level settings.
  *
  * @return void
  */
 private function init()
 {
     // Ensure this option is enabled or else line endings will not always
     // be detected properly for files created on a Mac with the /r line ending.
     ini_set('auto_detect_line_endings', true);
     // Check that the standards are valid.
     foreach ($this->config->standards as $standard) {
         if (Util\Standards::isInstalledStandard($standard) === false) {
             // They didn't select a valid coding standard, so help them
             // out by letting them know which standards are installed.
             echo 'ERROR: the "' . $standard . '" coding standard is not installed. ';
             Util\Standards::printInstalledStandards();
             exit(3);
         }
     }
     // Saves passing the Config object into other objects that only need
     // the verbostity flag for deubg output.
     if (defined('PHP_CODESNIFFER_VERBOSITY') === false) {
         define('PHP_CODESNIFFER_VERBOSITY', $this->config->verbosity);
     }
     // Create this class so it is autoloaded and sets up a bunch
     // of PHP_CodeSniffer-specific token type constants.
     $tokens = new Util\Tokens();
     // The ruleset contains all the information about how the files
     // should be checked and/or fixed.
     $this->ruleset = new Ruleset($this->config);
 }