Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace PHP_CodeSniffer; use PHP_CodeSniffer\Exceptions\RuntimeException; use PHP..
Decoded Output download
<?php
namespace PHP_CodeSniffer; use PHP_CodeSniffer\Exceptions\RuntimeException; use PHP_CodeSniffer\Util; use stdClass; class Ruleset { public $name = ''; public $paths = array(); public $ignorePatterns = array(); public $includePatterns = array(); public $sniffs = array(); public $sniffCodes = array(); public $tokenListeners = array(); public $ruleset = array(); protected $rulesetDirs = array(); private $config = null; public function __construct(Config $config) { $this->config = $config; $restrictions = $config->sniffs; $exclusions = $config->exclude; $sniffs = array(); $standardPaths = array(); foreach ($config->standards as $standard) { $installed = Util\Standards::getInstalledStandardPath($standard); if ($installed === null) { $standard = Util\Common::realpath($standard); if (is_dir($standard) === true && is_file(Util\Common::realpath($standard . DIRECTORY_SEPARATOR . "ruleset.xml")) === true) { $standard = Util\Common::realpath($standard . DIRECTORY_SEPARATOR . "ruleset.xml"); } } else { $standard = $installed; } $standardPaths[] = $standard; } foreach ($standardPaths as $standard) { $ruleset = @simplexml_load_string(file_get_contents($standard)); if ($ruleset !== false) { $standardName = (string) $ruleset["name"]; if ($this->name !== '') { $this->name .= ", "; } $this->name .= $standardName; if (isset($ruleset["namespace"]) === true) { $namespace = (string) $ruleset["namespace"]; } else { $namespace = basename(dirname($standard)); } Autoload::addSearchPath(dirname($standard), $namespace); } if (defined("PHP_CODESNIFFER_IN_TESTS") === true && empty($restrictions) === false) { try { foreach ($restrictions as $restriction) { $sniffs = array_merge($sniffs, $this->expandRulesetReference($restriction, dirname($standard))); } } catch (RuntimeException $e) { return; } break; } if (PHP_CODESNIFFER_VERBOSITY === 1) { echo "Registering sniffs in the {$standardName} standard... "; if (count($config->standards) > 1 || PHP_CODESNIFFER_VERBOSITY > 2) { echo PHP_EOL; } } $sniffs = array_merge($sniffs, $this->processRuleset($standard)); } if ($config->cache === true) { $restrictions = array(); $exclusions = array(); } $sniffRestrictions = array(); foreach ($restrictions as $sniffCode) { $parts = explode(".", strtolower($sniffCode)); $sniffName = $parts[0] . "\sniffs\" . $parts[1] . "\" . $parts[2] . "sniff"; $sniffRestrictions[$sniffName] = true; } $sniffExclusions = array(); foreach ($exclusions as $sniffCode) { $parts = explode(".", strtolower($sniffCode)); $sniffName = $parts[0] . "\sniffs\" . $parts[1] . "\" . $parts[2] . "sniff"; $sniffExclusions[$sniffName] = true; } $this->registerSniffs($sniffs, $sniffRestrictions, $sniffExclusions); $this->populateTokenListeners(); $numSniffs = count($this->sniffs); if (PHP_CODESNIFFER_VERBOSITY === 1) { echo "DONE ({$numSniffs} sniffs registered)" . PHP_EOL; } if ($numSniffs === 0) { throw new RuntimeException("No sniffs were registered"); } } public function explain() { $sniffs = array_keys($this->sniffCodes); sort($sniffs); ob_start(); $lastStandard = null; $lastCount = ''; $sniffCount = count($sniffs); $sniffs[] = ''; $summaryLine = PHP_EOL . "The {$this->name} standard contains 1 sniff" . PHP_EOL; if ($sniffCount !== 1) { $summaryLine = str_replace("1 sniff", "{$sniffCount} sniffs", $summaryLine); } echo $summaryLine; ob_start(); foreach ($sniffs as $i => $sniff) { if ($i === $sniffCount) { $currentStandard = null; } else { $currentStandard = substr($sniff, 0, strpos($sniff, ".")); if ($lastStandard === null) { $lastStandard = $currentStandard; } } if ($currentStandard !== $lastStandard) { $sniffList = ob_get_contents(); ob_end_clean(); echo PHP_EOL . $lastStandard . " (" . $lastCount . " sniff"; if ($lastCount > 1) { echo "s"; } echo ")" . PHP_EOL; echo str_repeat("-", strlen($lastStandard . $lastCount) + 10); echo PHP_EOL; echo $sniffList; $lastStandard = $currentStandard; $lastCount = 0; if ($currentStandard === null) { break; } ob_start(); } echo " " . $sniff . PHP_EOL; $lastCount++; } } public function processRuleset($rulesetPath, $depth = 0) { $rulesetPath = Util\Common::realpath($rulesetPath); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "Processing ruleset " . Util\Common::stripBasepath($rulesetPath, $this->config->basepath) . PHP_EOL; } libxml_use_internal_errors(true); $ruleset = simplexml_load_string(file_get_contents($rulesetPath)); if ($ruleset === false) { $errorMsg = "Ruleset {$rulesetPath} is not valid" . PHP_EOL; $errors = libxml_get_errors(); foreach ($errors as $error) { $errorMsg .= "- On line " . $error->line . ", column " . $error->column . ": " . $error->message; } libxml_clear_errors(); throw new RuntimeException($errorMsg); } libxml_use_internal_errors(false); $ownSniffs = array(); $includedSniffs = array(); $excludedSniffs = array(); $this->paths[] = $rulesetPath; $rulesetDir = dirname($rulesetPath); $this->rulesetDirs[] = $rulesetDir; $sniffDir = $rulesetDir . DIRECTORY_SEPARATOR . "Sniffs"; if (is_dir($sniffDir) === true) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo " Adding sniff files from " . Util\Common::stripBasepath($sniffDir, $this->config->basepath) . " directory" . PHP_EOL; } $ownSniffs = $this->expandSniffDirectory($sniffDir, $depth); } foreach ($ruleset->{"autoload"} as $autoload) { if ($this->shouldProcessElement($autoload) === false) { continue; } $autoloadPath = (string) $autoload; $relativePath = Util\Common::realPath(dirname($rulesetPath) . DIRECTORY_SEPARATOR . $autoloadPath); if ($relativePath !== false && is_file($relativePath) === true) { $autoloadPath = $relativePath; } else { if (is_file($autoloadPath) === false) { throw new RuntimeException("The specified autoload file "" . $autoload . "" does not exist"); } } include_once $autoloadPath; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo " => included autoloader {$autoloadPath}" . PHP_EOL; } } foreach ($ruleset->{"config"} as $config) { if ($this->shouldProcessElement($config) === false) { continue; } Config::setConfigData((string) $config["name"], (string) $config["value"], true); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo " => set config value " . (string) $config["name"] . ": " . (string) $config["value"] . PHP_EOL; } } foreach ($ruleset->rule as $rule) { if (isset($rule["ref"]) === false || $this->shouldProcessElement($rule) === false) { continue; } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo "\x9Processing rule "" . $rule["ref"] . """ . PHP_EOL; } $expandedSniffs = $this->expandRulesetReference((string) $rule["ref"], $rulesetDir, $depth); $newSniffs = array_diff($expandedSniffs, $includedSniffs); $includedSniffs = array_merge($includedSniffs, $expandedSniffs); $parts = explode(".", $rule["ref"]); if (count($parts) === 4 && $parts[0] !== '' && $parts[1] !== '' && $parts[2] !== '') { $sniffCode = $parts[0] . "." . $parts[1] . "." . $parts[2]; if (isset($this->ruleset[$sniffCode]["severity"]) === true && $this->ruleset[$sniffCode]["severity"] === 0) { $this->ruleset[(string) $rule["ref"]]["severity"] = 5; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo " * disabling sniff exclusion for specific message code *" . PHP_EOL; echo str_repeat("\x9", $depth); echo "\x9\x9=> severity set to 5" . PHP_EOL; } } else { if (empty($newSniffs) === false) { $newSniff = $newSniffs[0]; if (in_array($newSniff, $ownSniffs, true) === false) { $this->ruleset[$sniffCode]["severity"] = 0; $this->ruleset[(string) $rule["ref"]]["severity"] = 5; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9 Excluding sniff "" . $sniffCode . "" except for "" . $parts[3] . """ . PHP_EOL; } } } } } if (isset($rule->exclude) === true) { foreach ($rule->exclude as $exclude) { if (isset($exclude["name"]) === false) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9 * ignoring empty exclude rule *" . PHP_EOL; echo " \x9\x9=> " . $exclude->asXML() . PHP_EOL; } continue; } if ($this->shouldProcessElement($exclude) === false) { continue; } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo "\x9\x9Excluding rule "" . $exclude["name"] . """ . PHP_EOL; } $parts = explode(".", $exclude["name"]); if (count($parts) === 4) { $this->ruleset[(string) $exclude["name"]]["severity"] = 0; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9 => severity set to 0" . PHP_EOL; } } else { $excludedSniffs = array_merge($excludedSniffs, $this->expandRulesetReference((string) $exclude["name"], $rulesetDir, $depth + 1)); } } } $this->processRule($rule, $newSniffs, $depth); } $cliArgs = array(); foreach ($ruleset->{"arg"} as $arg) { if ($this->shouldProcessElement($arg) === false) { continue; } if (isset($arg["name"]) === true) { $argString = "--" . (string) $arg["name"]; if (isset($arg["value"]) === true) { $argString .= "=" . (string) $arg["value"]; } } else { $argString = "-" . (string) $arg["value"]; } $cliArgs[] = $argString; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9=> set command line value {$argString}" . PHP_EOL; } } foreach ($ruleset->{"ini"} as $arg) { if ($this->shouldProcessElement($arg) === false) { continue; } if (isset($arg["name"]) === false) { continue; } $name = (string) $arg["name"]; $argString = $name; if (isset($arg["value"]) === true) { $value = (string) $arg["value"]; $argString .= "={$value}"; } else { $value = "true"; } $cliArgs[] = "-d"; $cliArgs[] = $argString; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9=> set PHP ini value {$name} to {$value}" . PHP_EOL; } } if (empty($this->config->files) === true) { foreach ($ruleset->{"file"} as $file) { $file = (string) $file; $cliArgs[] = $file; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo " => added "{$file}" to the file list" . PHP_EOL; } } } if (empty($cliArgs) === false) { $inPhar = Util\Common::isPharFile($rulesetDir); if ($inPhar === false) { $currentDir = getcwd(); chdir($rulesetDir); } $this->config->setCommandLineValues($cliArgs); if ($inPhar === false) { chdir($currentDir); } } foreach ($ruleset->{"exclude-pattern"} as $pattern) { if ($this->shouldProcessElement($pattern) === false) { continue; } if (isset($pattern["type"]) === false) { $pattern["type"] = "absolute"; } $this->ignorePatterns[(string) $pattern] = (string) $pattern["type"]; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9=> added global " . (string) $pattern["type"] . " ignore pattern: " . (string) $pattern . PHP_EOL; } } $includedSniffs = array_unique(array_merge($ownSniffs, $includedSniffs)); $excludedSniffs = array_unique($excludedSniffs); if (PHP_CODESNIFFER_VERBOSITY > 1) { $included = count($includedSniffs); $excluded = count($excludedSniffs); echo str_repeat(" ", $depth); echo "=> Ruleset processing complete; included {$included} sniffs and excluded {$excluded}" . PHP_EOL; } $files = array(); foreach ($includedSniffs as $sniff) { if (in_array($sniff, $excludedSniffs, true) === true) { continue; } else { $files[] = Util\Common::realpath($sniff); } } return $files; } private function expandSniffDirectory($directory, $depth = 0) { $sniffs = array(); $rdi = new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS); $di = new \RecursiveIteratorIterator($rdi, 0, \RecursiveIteratorIterator::CATCH_GET_CHILD); $dirLen = strlen($directory); foreach ($di as $file) { $filename = $file->getFilename(); if (substr($filename, 0, 1) === ".") { continue; } $fileParts = explode(".", $filename); if (array_pop($fileParts) !== "php") { continue; } $basename = basename($filename, ".php"); if (substr($basename, -5) !== "Sniff") { continue; } $path = $file->getPathname(); if (strpos($path, DIRECTORY_SEPARATOR . ".", $dirLen) !== false) { continue; } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo " \x9=> " . Util\Common::stripBasepath($path, $this->config->basepath) . PHP_EOL; } $sniffs[] = $path; } return $sniffs; } private function expandRulesetReference($ref, $rulesetDir, $depth = 0) { if (substr($ref, 0, 9) === "Internal.") { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo " * ignoring internal sniff code *" . PHP_EOL; } return array(); } if (substr($ref, 0, 1) === ".") { $realpath = Util\Common::realpath($rulesetDir . "/" . $ref); if ($realpath !== false) { $ref = $realpath; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo " \x9=> " . Util\Common::stripBasepath($ref, $this->config->basepath) . PHP_EOL; } } } if (substr($ref, 0, 2) === "~/") { $realpath = Util\Common::realpath($ref); if ($realpath !== false) { $ref = $realpath; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo " => " . Util\Common::stripBasepath($ref, $this->config->basepath) . PHP_EOL; } } } if (is_file($ref) === true) { if (substr($ref, -9) === "Sniff.php") { $this->rulesetDirs[] = dirname(dirname(dirname($ref))); return array($ref); } } else { $path = Util\Standards::getInstalledStandardPath($ref); if ($path !== null && Util\Common::isPharFile($path) === true && strpos($path, "ruleset.xml") === false) { if (file_exists($path . DIRECTORY_SEPARATOR . "ruleset.xml") === true) { $path .= DIRECTORY_SEPARATOR . "ruleset.xml"; } else { $path = null; } } if ($path !== null) { $ref = $path; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo "\x9 => " . Util\Common::stripBasepath($ref, $this->config->basepath) . PHP_EOL; } } else { if (is_dir($ref) === false) { $sepPos = strpos($ref, DIRECTORY_SEPARATOR); if ($sepPos !== false) { $stdName = substr($ref, 0, $sepPos); $path = substr($ref, $sepPos); } else { $parts = explode(".", $ref); $stdName = $parts[0]; if (count($parts) === 1) { $path = ''; } else { if (count($parts) === 2) { $path = DIRECTORY_SEPARATOR . "Sniffs" . DIRECTORY_SEPARATOR . $parts[1]; } else { $path = DIRECTORY_SEPARATOR . "Sniffs" . DIRECTORY_SEPARATOR . $parts[1] . DIRECTORY_SEPARATOR . $parts[2] . "Sniff.php"; } } } $newRef = false; $stdPath = Util\Standards::getInstalledStandardPath($stdName); if ($stdPath !== null && $path !== '') { if (Util\Common::isPharFile($stdPath) === true && strpos($stdPath, "ruleset.xml") === false) { $newRef = Util\Common::realpath($stdPath . $path); } else { $newRef = Util\Common::realpath(dirname($stdPath) . $path); } } if ($newRef === false) { foreach ($this->rulesetDirs as $dir) { if (strtolower(basename($dir)) !== strtolower($stdName)) { continue; } $newRef = Util\Common::realpath($dir . $path); if ($newRef !== false) { $ref = $newRef; } } } else { $ref = $newRef; } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo "\x9 => " . Util\Common::stripBasepath($ref, $this->config->basepath) . PHP_EOL; } } } } if (is_dir($ref) === true) { if (is_file($ref . DIRECTORY_SEPARATOR . "ruleset.xml") === true) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo " \x9* rule is referencing a standard using directory name; processing *" . PHP_EOL; } return $this->processRuleset($ref . DIRECTORY_SEPARATOR . "ruleset.xml", $depth + 2); } else { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo " * rule is referencing a directory of sniffs *" . PHP_EOL; echo str_repeat(" ", $depth); echo " Adding sniff files from directory" . PHP_EOL; } return $this->expandSniffDirectory($ref, $depth + 1); } } else { if (is_file($ref) === false) { $error = "Referenced sniff "{$ref}" does not exist"; throw new RuntimeException($error); } if (substr($ref, -9) === "Sniff.php") { return array($ref); } else { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo " * rule is referencing a standard using ruleset path; processing *" . PHP_EOL; } return $this->processRuleset($ref, $depth + 2); } } } private function processRule($rule, $newSniffs, $depth = 0) { $ref = (string) $rule["ref"]; $todo = array($ref); $parts = explode(".", $ref); $partsCount = count($parts); if ($partsCount <= 2 || $partsCount > count(array_filter($parts)) || in_array($ref, $newSniffs) === true) { foreach ($newSniffs as $sniffFile) { $parts = explode(DIRECTORY_SEPARATOR, $sniffFile); if (count($parts) === 1 && DIRECTORY_SEPARATOR === "\") { $parts = explode("/", $sniffFile); } $sniffName = array_pop($parts); $sniffCategory = array_pop($parts); array_pop($parts); $sniffStandard = array_pop($parts); $todo[] = $sniffStandard . "." . $sniffCategory . "." . substr($sniffName, 0, -9); } } foreach ($todo as $code) { if (isset($rule->severity) === true && $this->shouldProcessElement($rule->severity) === true) { if (isset($this->ruleset[$code]) === false) { $this->ruleset[$code] = array(); } $this->ruleset[$code]["severity"] = (int) $rule->severity; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo " => severity set to " . (int) $rule->severity; if ($code !== $ref) { echo " for {$code}"; } echo PHP_EOL; } } if (isset($rule->type) === true && $this->shouldProcessElement($rule->type) === true) { if (isset($this->ruleset[$code]) === false) { $this->ruleset[$code] = array(); } $type = strtolower((string) $rule->type); if ($type !== "error" && $type !== "warning") { throw new RuntimeException("Message type "{$type}" is invalid; must be "error" or "warning""); } $this->ruleset[$code]["type"] = $type; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo "\x9 => message type set to " . (string) $rule->type; if ($code !== $ref) { echo " for {$code}"; } echo PHP_EOL; } } if (isset($rule->message) === true && $this->shouldProcessElement($rule->message) === true) { if (isset($this->ruleset[$code]) === false) { $this->ruleset[$code] = array(); } $this->ruleset[$code]["message"] = (string) $rule->message; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo "\x9 => message set to " . (string) $rule->message; if ($code !== $ref) { echo " for {$code}"; } echo PHP_EOL; } } if (isset($rule->properties) === true && $this->shouldProcessElement($rule->properties) === true) { $propertyScope = "standard"; if ($code === $ref || substr($ref, -9) === "Sniff.php") { $propertyScope = "sniff"; } foreach ($rule->properties->property as $prop) { if ($this->shouldProcessElement($prop) === false) { continue; } if (isset($this->ruleset[$code]) === false) { $this->ruleset[$code] = array("properties" => array()); } else { if (isset($this->ruleset[$code]["properties"]) === false) { $this->ruleset[$code]["properties"] = array(); } } $name = (string) $prop["name"]; if (isset($prop["type"]) === true && (string) $prop["type"] === "array") { $values = array(); if (isset($prop["extend"]) === true && (string) $prop["extend"] === "true" && isset($this->ruleset[$code]["properties"][$name]["value"]) === true) { $values = $this->ruleset[$code]["properties"][$name]["value"]; } if (isset($prop->element) === true) { $printValue = ''; foreach ($prop->element as $element) { if ($this->shouldProcessElement($element) === false) { continue; } $value = (string) $element["value"]; if (isset($element["key"]) === true) { $key = (string) $element["key"]; $values[$key] = $value; $printValue .= $key . "=>" . $value . ","; } else { $values[] = $value; $printValue .= $value . ","; } } $printValue = rtrim($printValue, ","); } else { $value = (string) $prop["value"]; $printValue = $value; foreach (explode(",", $value) as $val) { list($k, $v) = explode("=>", $val . "=>"); if ($v !== '') { $values[trim($k)] = trim($v); } else { $values[] = trim($k); } } } $this->ruleset[$code]["properties"][$name] = array("value" => $values, "scope" => $propertyScope); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo "\x9 => array property "{$name}" set to "{$printValue}""; if ($code !== $ref) { echo " for {$code}"; } echo PHP_EOL; } } else { $this->ruleset[$code]["properties"][$name] = array("value" => (string) $prop["value"], "scope" => $propertyScope); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo " \x9=> property "{$name}" set to "" . (string) $prop["value"] . """; if ($code !== $ref) { echo " for {$code}"; } echo PHP_EOL; } } } } foreach ($rule->{"exclude-pattern"} as $pattern) { if ($this->shouldProcessElement($pattern) === false) { continue; } if (isset($this->ignorePatterns[$code]) === false) { $this->ignorePatterns[$code] = array(); } if (isset($pattern["type"]) === false) { $pattern["type"] = "absolute"; } $this->ignorePatterns[$code][(string) $pattern] = (string) $pattern["type"]; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9 => added rule-specific " . (string) $pattern["type"] . " ignore pattern"; if ($code !== $ref) { echo " for {$code}"; } echo ": " . (string) $pattern . PHP_EOL; } } foreach ($rule->{"include-pattern"} as $pattern) { if ($this->shouldProcessElement($pattern) === false) { continue; } if (isset($this->includePatterns[$code]) === false) { $this->includePatterns[$code] = array(); } if (isset($pattern["type"]) === false) { $pattern["type"] = "absolute"; } $this->includePatterns[$code][(string) $pattern] = (string) $pattern["type"]; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat(" ", $depth); echo "\x9\x9=> added rule-specific " . (string) $pattern["type"] . " include pattern"; if ($code !== $ref) { echo " for {$code}"; } echo ": " . (string) $pattern . PHP_EOL; } } } } private function shouldProcessElement($element) { if (isset($element["phpcbf-only"]) === false && isset($element["phpcs-only"]) === false) { return true; } if (PHP_CODESNIFFER_CBF === true && isset($element["phpcbf-only"]) === true && (string) $element["phpcbf-only"] === "true") { return true; } if (PHP_CODESNIFFER_CBF === false && isset($element["phpcs-only"]) === true && (string) $element["phpcs-only"] === "true") { return true; } return false; } public function registerSniffs($files, $restrictions, $exclusions) { $listeners = array(); foreach ($files as $file) { $sniffPos = strrpos($file, DIRECTORY_SEPARATOR . "Sniffs" . DIRECTORY_SEPARATOR); if ($sniffPos === false) { continue; } $slashPos = strrpos(substr($file, 0, $sniffPos), DIRECTORY_SEPARATOR); if ($slashPos === false) { continue; } $className = Autoload::loadFile($file); $compareName = Util\Common::cleanSniffClass($className); if (empty($restrictions) === false && isset($restrictions[$compareName]) === false) { continue; } if (empty($exclusions) === false && isset($exclusions[$compareName]) === true) { continue; } $reflection = new \ReflectionClass($className); if ($reflection->isAbstract() === true) { continue; } $listeners[$className] = $className; if (PHP_CODESNIFFER_VERBOSITY > 2) { echo "Registered {$className}" . PHP_EOL; } } $this->sniffs = $listeners; } public function populateTokenListeners() { $this->tokenListeners = array(); foreach ($this->sniffs as $sniffClass => $sniffObject) { $this->sniffs[$sniffClass] = null; $this->sniffs[$sniffClass] = new $sniffClass(); $sniffCode = Util\Common::getSniffCode($sniffClass); $this->sniffCodes[$sniffCode] = $sniffClass; if (isset($this->ruleset[$sniffCode]["properties"]) === true) { foreach ($this->ruleset[$sniffCode]["properties"] as $name => $settings) { $this->setSniffProperty($sniffClass, $name, $settings); } } $tokenizers = array(); $vars = get_class_vars($sniffClass); if (isset($vars["supportedTokenizers"]) === true) { foreach ($vars["supportedTokenizers"] as $tokenizer) { $tokenizers[$tokenizer] = $tokenizer; } } else { $tokenizers = array("PHP" => "PHP"); } $tokens = $this->sniffs[$sniffClass]->register(); if (is_array($tokens) === false) { $msg = "Sniff {$sniffClass} register() method must return an array"; throw new RuntimeException($msg); } $ignorePatterns = array(); $patterns = $this->getIgnorePatterns($sniffCode); foreach ($patterns as $pattern => $type) { $replacements = array("\," => ",", "*" => ".*"); $ignorePatterns[] = strtr($pattern, $replacements); } $includePatterns = array(); $patterns = $this->getIncludePatterns($sniffCode); foreach ($patterns as $pattern => $type) { $replacements = array("\," => ",", "*" => ".*"); $includePatterns[] = strtr($pattern, $replacements); } foreach ($tokens as $token) { if (isset($this->tokenListeners[$token]) === false) { $this->tokenListeners[$token] = array(); } if (isset($this->tokenListeners[$token][$sniffClass]) === false) { $this->tokenListeners[$token][$sniffClass] = array("class" => $sniffClass, "source" => $sniffCode, "tokenizers" => $tokenizers, "ignore" => $ignorePatterns, "include" => $includePatterns); } } } } public function setSniffProperty($sniffClass, $name, $settings) { if (isset($this->sniffs[$sniffClass]) === false) { return; } $name = trim($name); $propertyName = $name; if (substr($propertyName, -2) === "[]") { $propertyName = substr($propertyName, 0, -2); } if (is_array($settings) === false || isset($settings["scope"], $settings["value"]) === false) { $settings = array("value" => $settings, "scope" => "standard"); trigger_error(__FUNCTION__ . ": the format of the $settings parameter has changed from (mixed) $value to array('scope' => 'sniff|standard', 'value' => $value). Please update your integration code. See PR #3629 for more information.", E_USER_DEPRECATED); } $isSettable = false; $sniffObject = $this->sniffs[$sniffClass]; if (property_exists($sniffObject, $propertyName) === true || $sniffObject instanceof stdClass === true || method_exists($sniffObject, "__set") === true) { $isSettable = true; } if ($isSettable === false) { if ($settings["scope"] === "sniff") { $notice = "Ruleset invalid. Property "{$propertyName}" does not exist on sniff "; $notice .= array_search($sniffClass, $this->sniffCodes, true); throw new RuntimeException($notice); } return; } $value = $settings["value"]; if (is_string($value) === true) { $value = trim($value); } if ($value === '') { $value = null; } if ($value === "true") { $value = true; } else { if ($value === "false") { $value = false; } else { if (substr($name, -2) === "[]") { $name = $propertyName; $values = array(); if ($value !== null) { foreach (explode(",", $value) as $val) { list($k, $v) = explode("=>", $val . "=>"); if ($v !== '') { $values[trim($k)] = trim($v); } else { $values[] = trim($k); } } } $value = $values; } } } $sniffObject->{$name} = $value; } public function getIgnorePatterns($listener = null) { if ($listener === null) { return $this->ignorePatterns; } if (isset($this->ignorePatterns[$listener]) === true) { return $this->ignorePatterns[$listener]; } return array(); } public function getIncludePatterns($listener = null) { if ($listener === null) { return $this->includePatterns; } if (isset($this->includePatterns[$listener]) === true) { return $this->includePatterns[$listener]; } return array(); } } ?>
Did this file decode correctly?
Original Code
<?php
namespace PHP_CodeSniffer; use PHP_CodeSniffer\Exceptions\RuntimeException; use PHP_CodeSniffer\Util; use stdClass; class Ruleset { public $name = ''; public $paths = array(); public $ignorePatterns = array(); public $includePatterns = array(); public $sniffs = array(); public $sniffCodes = array(); public $tokenListeners = array(); public $ruleset = array(); protected $rulesetDirs = array(); private $config = null; public function __construct(Config $config) { $this->config = $config; $restrictions = $config->sniffs; $exclusions = $config->exclude; $sniffs = array(); $standardPaths = array(); foreach ($config->standards as $standard) { $installed = Util\Standards::getInstalledStandardPath($standard); if ($installed === null) { $standard = Util\Common::realpath($standard); if (is_dir($standard) === true && is_file(Util\Common::realpath($standard . DIRECTORY_SEPARATOR . "\x72\165\154\x65\x73\145\164\56\170\155\x6c")) === true) { $standard = Util\Common::realpath($standard . DIRECTORY_SEPARATOR . "\x72\165\x6c\145\163\x65\164\56\x78\155\154"); } } else { $standard = $installed; } $standardPaths[] = $standard; } foreach ($standardPaths as $standard) { $ruleset = @simplexml_load_string(file_get_contents($standard)); if ($ruleset !== false) { $standardName = (string) $ruleset["\x6e\x61\155\x65"]; if ($this->name !== '') { $this->name .= "\x2c\40"; } $this->name .= $standardName; if (isset($ruleset["\156\x61\x6d\x65\x73\160\x61\x63\x65"]) === true) { $namespace = (string) $ruleset["\x6e\x61\155\145\163\160\141\x63\145"]; } else { $namespace = basename(dirname($standard)); } Autoload::addSearchPath(dirname($standard), $namespace); } if (defined("\x50\x48\120\x5f\x43\x4f\104\105\123\116\x49\106\106\x45\x52\x5f\111\116\x5f\124\x45\x53\x54\123") === true && empty($restrictions) === false) { try { foreach ($restrictions as $restriction) { $sniffs = array_merge($sniffs, $this->expandRulesetReference($restriction, dirname($standard))); } } catch (RuntimeException $e) { return; } break; } if (PHP_CODESNIFFER_VERBOSITY === 1) { echo "\122\145\147\x69\x73\164\x65\162\x69\x6e\147\x20\x73\156\x69\x66\x66\x73\x20\x69\x6e\x20\164\150\145\x20{$standardName}\40\163\x74\141\x6e\x64\141\162\144\56\56\56\40"; if (count($config->standards) > 1 || PHP_CODESNIFFER_VERBOSITY > 2) { echo PHP_EOL; } } $sniffs = array_merge($sniffs, $this->processRuleset($standard)); } if ($config->cache === true) { $restrictions = array(); $exclusions = array(); } $sniffRestrictions = array(); foreach ($restrictions as $sniffCode) { $parts = explode("\56", strtolower($sniffCode)); $sniffName = $parts[0] . "\x5c\163\x6e\x69\x66\146\163\x5c" . $parts[1] . "\x5c" . $parts[2] . "\163\x6e\x69\146\x66"; $sniffRestrictions[$sniffName] = true; } $sniffExclusions = array(); foreach ($exclusions as $sniffCode) { $parts = explode("\56", strtolower($sniffCode)); $sniffName = $parts[0] . "\x5c\163\x6e\x69\146\x66\x73\x5c" . $parts[1] . "\x5c" . $parts[2] . "\163\x6e\151\x66\146"; $sniffExclusions[$sniffName] = true; } $this->registerSniffs($sniffs, $sniffRestrictions, $sniffExclusions); $this->populateTokenListeners(); $numSniffs = count($this->sniffs); if (PHP_CODESNIFFER_VERBOSITY === 1) { echo "\104\x4f\x4e\x45\x20\x28{$numSniffs}\x20\163\156\x69\146\146\163\40\x72\145\147\151\x73\164\x65\x72\x65\144\51" . PHP_EOL; } if ($numSniffs === 0) { throw new RuntimeException("\116\157\x20\x73\156\x69\x66\146\163\x20\x77\145\x72\145\40\162\145\147\151\x73\164\x65\162\145\144"); } } public function explain() { $sniffs = array_keys($this->sniffCodes); sort($sniffs); ob_start(); $lastStandard = null; $lastCount = ''; $sniffCount = count($sniffs); $sniffs[] = ''; $summaryLine = PHP_EOL . "\124\150\x65\x20{$this->name}\x20\x73\164\x61\156\x64\141\x72\x64\x20\x63\157\x6e\164\x61\x69\156\163\40\x31\x20\163\x6e\x69\146\146" . PHP_EOL; if ($sniffCount !== 1) { $summaryLine = str_replace("\x31\40\163\x6e\x69\x66\x66", "{$sniffCount}\x20\x73\156\151\146\146\x73", $summaryLine); } echo $summaryLine; ob_start(); foreach ($sniffs as $i => $sniff) { if ($i === $sniffCount) { $currentStandard = null; } else { $currentStandard = substr($sniff, 0, strpos($sniff, "\56")); if ($lastStandard === null) { $lastStandard = $currentStandard; } } if ($currentStandard !== $lastStandard) { $sniffList = ob_get_contents(); ob_end_clean(); echo PHP_EOL . $lastStandard . "\x20\50" . $lastCount . "\40\x73\x6e\x69\146\x66"; if ($lastCount > 1) { echo "\x73"; } echo "\x29" . PHP_EOL; echo str_repeat("\x2d", strlen($lastStandard . $lastCount) + 10); echo PHP_EOL; echo $sniffList; $lastStandard = $currentStandard; $lastCount = 0; if ($currentStandard === null) { break; } ob_start(); } echo "\40\x20" . $sniff . PHP_EOL; $lastCount++; } } public function processRuleset($rulesetPath, $depth = 0) { $rulesetPath = Util\Common::realpath($rulesetPath); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\120\x72\157\x63\x65\x73\x73\x69\156\x67\x20\162\165\154\x65\x73\145\x74\40" . Util\Common::stripBasepath($rulesetPath, $this->config->basepath) . PHP_EOL; } libxml_use_internal_errors(true); $ruleset = simplexml_load_string(file_get_contents($rulesetPath)); if ($ruleset === false) { $errorMsg = "\122\165\x6c\145\163\x65\164\40{$rulesetPath}\x20\x69\x73\40\156\x6f\164\40\x76\141\154\151\x64" . PHP_EOL; $errors = libxml_get_errors(); foreach ($errors as $error) { $errorMsg .= "\x2d\x20\117\x6e\x20\x6c\151\156\x65\x20" . $error->line . "\x2c\x20\x63\x6f\154\165\155\x6e\x20" . $error->column . "\72\40" . $error->message; } libxml_clear_errors(); throw new RuntimeException($errorMsg); } libxml_use_internal_errors(false); $ownSniffs = array(); $includedSniffs = array(); $excludedSniffs = array(); $this->paths[] = $rulesetPath; $rulesetDir = dirname($rulesetPath); $this->rulesetDirs[] = $rulesetDir; $sniffDir = $rulesetDir . DIRECTORY_SEPARATOR . "\x53\x6e\x69\x66\146\163"; if (is_dir($sniffDir) === true) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\11\101\144\144\151\x6e\x67\x20\163\156\151\146\146\x20\x66\x69\x6c\x65\x73\x20\x66\162\x6f\x6d\x20" . Util\Common::stripBasepath($sniffDir, $this->config->basepath) . "\x20\144\x69\162\x65\x63\164\x6f\162\x79" . PHP_EOL; } $ownSniffs = $this->expandSniffDirectory($sniffDir, $depth); } foreach ($ruleset->{"\141\165\x74\x6f\154\157\141\144"} as $autoload) { if ($this->shouldProcessElement($autoload) === false) { continue; } $autoloadPath = (string) $autoload; $relativePath = Util\Common::realPath(dirname($rulesetPath) . DIRECTORY_SEPARATOR . $autoloadPath); if ($relativePath !== false && is_file($relativePath) === true) { $autoloadPath = $relativePath; } else { if (is_file($autoloadPath) === false) { throw new RuntimeException("\124\150\145\x20\x73\160\145\143\151\146\151\x65\144\40\x61\165\x74\157\x6c\x6f\141\144\40\146\x69\x6c\x65\x20\x22" . $autoload . "\42\40\144\x6f\145\x73\x20\x6e\x6f\x74\x20\145\170\151\x73\x74"); } } include_once $autoloadPath; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\11\75\76\40\151\156\x63\154\x75\144\145\x64\x20\141\165\x74\x6f\x6c\157\x61\144\x65\162\x20{$autoloadPath}" . PHP_EOL; } } foreach ($ruleset->{"\143\157\156\146\151\147"} as $config) { if ($this->shouldProcessElement($config) === false) { continue; } Config::setConfigData((string) $config["\156\x61\155\x65"], (string) $config["\x76\141\x6c\x75\145"], true); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\11\75\x3e\40\x73\145\164\40\143\157\156\x66\x69\x67\x20\166\141\x6c\165\x65\40" . (string) $config["\156\x61\x6d\145"] . "\x3a\x20" . (string) $config["\x76\141\x6c\x75\x65"] . PHP_EOL; } } foreach ($ruleset->rule as $rule) { if (isset($rule["\162\x65\146"]) === false || $this->shouldProcessElement($rule) === false) { continue; } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\x9\x50\x72\x6f\x63\x65\x73\x73\151\x6e\x67\x20\x72\165\154\145\x20\42" . $rule["\162\x65\146"] . "\42" . PHP_EOL; } $expandedSniffs = $this->expandRulesetReference((string) $rule["\162\x65\146"], $rulesetDir, $depth); $newSniffs = array_diff($expandedSniffs, $includedSniffs); $includedSniffs = array_merge($includedSniffs, $expandedSniffs); $parts = explode("\x2e", $rule["\162\x65\146"]); if (count($parts) === 4 && $parts[0] !== '' && $parts[1] !== '' && $parts[2] !== '') { $sniffCode = $parts[0] . "\x2e" . $parts[1] . "\56" . $parts[2]; if (isset($this->ruleset[$sniffCode]["\163\x65\166\x65\162\x69\x74\171"]) === true && $this->ruleset[$sniffCode]["\x73\x65\166\145\x72\151\164\x79"] === 0) { $this->ruleset[(string) $rule["\x72\145\x66"]]["\163\x65\x76\x65\162\x69\164\x79"] = 5; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\11\11\x2a\x20\144\x69\163\141\142\x6c\151\x6e\x67\x20\x73\156\151\146\146\x20\x65\x78\x63\154\x75\x73\151\x6f\156\x20\146\157\x72\x20\163\x70\x65\x63\x69\146\151\x63\x20\155\x65\163\163\141\x67\145\x20\x63\x6f\144\x65\40\52" . PHP_EOL; echo str_repeat("\x9", $depth); echo "\x9\x9\75\76\40\163\145\x76\145\x72\x69\164\171\40\163\145\x74\40\x74\x6f\40\x35" . PHP_EOL; } } else { if (empty($newSniffs) === false) { $newSniff = $newSniffs[0]; if (in_array($newSniff, $ownSniffs, true) === false) { $this->ruleset[$sniffCode]["\163\145\166\x65\x72\x69\x74\171"] = 0; $this->ruleset[(string) $rule["\162\x65\146"]]["\163\x65\x76\x65\x72\151\164\171"] = 5; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9\11\x45\170\143\x6c\165\x64\151\156\147\x20\x73\156\x69\x66\146\x20\x22" . $sniffCode . "\42\40\x65\x78\143\x65\x70\164\x20\146\x6f\x72\x20\42" . $parts[3] . "\42" . PHP_EOL; } } } } } if (isset($rule->exclude) === true) { foreach ($rule->exclude as $exclude) { if (isset($exclude["\156\141\155\145"]) === false) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9\11\52\x20\151\x67\156\157\162\151\156\147\x20\145\x6d\160\x74\x79\40\x65\170\143\x6c\x75\x64\x65\40\x72\x75\154\x65\x20\x2a" . PHP_EOL; echo "\11\x9\x9\75\x3e\40" . $exclude->asXML() . PHP_EOL; } continue; } if ($this->shouldProcessElement($exclude) === false) { continue; } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\x9\x9\105\170\x63\x6c\x75\144\x69\x6e\147\x20\x72\x75\x6c\x65\40\x22" . $exclude["\x6e\x61\x6d\145"] . "\x22" . PHP_EOL; } $parts = explode("\x2e", $exclude["\156\x61\155\145"]); if (count($parts) === 4) { $this->ruleset[(string) $exclude["\156\141\x6d\x65"]]["\163\x65\x76\x65\162\x69\x74\x79"] = 0; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9\11\75\76\40\163\145\166\145\x72\x69\x74\x79\40\163\x65\x74\40\164\157\40\x30" . PHP_EOL; } } else { $excludedSniffs = array_merge($excludedSniffs, $this->expandRulesetReference((string) $exclude["\x6e\141\155\x65"], $rulesetDir, $depth + 1)); } } } $this->processRule($rule, $newSniffs, $depth); } $cliArgs = array(); foreach ($ruleset->{"\x61\162\147"} as $arg) { if ($this->shouldProcessElement($arg) === false) { continue; } if (isset($arg["\156\x61\155\145"]) === true) { $argString = "\55\x2d" . (string) $arg["\156\141\155\x65"]; if (isset($arg["\166\141\x6c\x75\x65"]) === true) { $argString .= "\x3d" . (string) $arg["\x76\141\x6c\x75\x65"]; } } else { $argString = "\x2d" . (string) $arg["\166\141\x6c\x75\145"]; } $cliArgs[] = $argString; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9\75\x3e\40\163\x65\164\x20\x63\x6f\x6d\x6d\x61\x6e\144\x20\154\151\156\x65\x20\166\141\x6c\x75\145\x20{$argString}" . PHP_EOL; } } foreach ($ruleset->{"\x69\156\151"} as $arg) { if ($this->shouldProcessElement($arg) === false) { continue; } if (isset($arg["\156\x61\x6d\145"]) === false) { continue; } $name = (string) $arg["\x6e\x61\x6d\145"]; $argString = $name; if (isset($arg["\166\141\154\x75\145"]) === true) { $value = (string) $arg["\x76\x61\154\165\145"]; $argString .= "\75{$value}"; } else { $value = "\164\x72\x75\x65"; } $cliArgs[] = "\55\x64"; $cliArgs[] = $argString; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9\75\76\x20\163\x65\164\40\120\x48\120\40\151\156\x69\x20\x76\141\154\x75\145\40{$name}\40\x74\157\40{$value}" . PHP_EOL; } } if (empty($this->config->files) === true) { foreach ($ruleset->{"\146\x69\x6c\145"} as $file) { $file = (string) $file; $cliArgs[] = $file; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\11\x3d\x3e\x20\141\144\144\x65\144\x20\x22{$file}\x22\40\x74\157\40\164\150\x65\x20\x66\151\x6c\145\40\x6c\x69\163\164" . PHP_EOL; } } } if (empty($cliArgs) === false) { $inPhar = Util\Common::isPharFile($rulesetDir); if ($inPhar === false) { $currentDir = getcwd(); chdir($rulesetDir); } $this->config->setCommandLineValues($cliArgs); if ($inPhar === false) { chdir($currentDir); } } foreach ($ruleset->{"\145\170\143\x6c\x75\144\x65\x2d\x70\x61\x74\164\145\162\156"} as $pattern) { if ($this->shouldProcessElement($pattern) === false) { continue; } if (isset($pattern["\x74\171\160\x65"]) === false) { $pattern["\164\171\160\x65"] = "\141\142\x73\x6f\154\x75\x74\x65"; } $this->ignorePatterns[(string) $pattern] = (string) $pattern["\164\171\160\x65"]; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9\75\76\x20\x61\144\144\145\144\40\147\x6c\x6f\142\x61\x6c\40" . (string) $pattern["\x74\x79\x70\x65"] . "\x20\151\147\x6e\x6f\162\145\40\160\x61\164\x74\145\162\156\x3a\40" . (string) $pattern . PHP_EOL; } } $includedSniffs = array_unique(array_merge($ownSniffs, $includedSniffs)); $excludedSniffs = array_unique($excludedSniffs); if (PHP_CODESNIFFER_VERBOSITY > 1) { $included = count($includedSniffs); $excluded = count($excludedSniffs); echo str_repeat("\11", $depth); echo "\75\x3e\x20\122\165\154\x65\163\145\164\x20\x70\x72\x6f\x63\x65\163\163\151\156\147\x20\143\157\155\x70\x6c\145\x74\x65\x3b\x20\151\x6e\x63\154\x75\144\145\144\40{$included}\40\x73\156\151\x66\x66\163\x20\x61\156\x64\x20\145\x78\143\154\x75\144\x65\144\40{$excluded}" . PHP_EOL; } $files = array(); foreach ($includedSniffs as $sniff) { if (in_array($sniff, $excludedSniffs, true) === true) { continue; } else { $files[] = Util\Common::realpath($sniff); } } return $files; } private function expandSniffDirectory($directory, $depth = 0) { $sniffs = array(); $rdi = new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS); $di = new \RecursiveIteratorIterator($rdi, 0, \RecursiveIteratorIterator::CATCH_GET_CHILD); $dirLen = strlen($directory); foreach ($di as $file) { $filename = $file->getFilename(); if (substr($filename, 0, 1) === "\x2e") { continue; } $fileParts = explode("\x2e", $filename); if (array_pop($fileParts) !== "\160\x68\160") { continue; } $basename = basename($filename, "\56\160\150\x70"); if (substr($basename, -5) !== "\x53\x6e\151\x66\x66") { continue; } $path = $file->getPathname(); if (strpos($path, DIRECTORY_SEPARATOR . "\56", $dirLen) !== false) { continue; } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\11\x9\x3d\x3e\40" . Util\Common::stripBasepath($path, $this->config->basepath) . PHP_EOL; } $sniffs[] = $path; } return $sniffs; } private function expandRulesetReference($ref, $rulesetDir, $depth = 0) { if (substr($ref, 0, 9) === "\111\x6e\164\x65\162\156\141\154\56") { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\11\11\52\40\x69\147\x6e\157\162\x69\x6e\147\x20\x69\x6e\164\x65\x72\x6e\141\x6c\x20\163\156\151\x66\x66\40\143\157\144\x65\40\x2a" . PHP_EOL; } return array(); } if (substr($ref, 0, 1) === "\x2e") { $realpath = Util\Common::realpath($rulesetDir . "\x2f" . $ref); if ($realpath !== false) { $ref = $realpath; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\11\x9\75\x3e\40" . Util\Common::stripBasepath($ref, $this->config->basepath) . PHP_EOL; } } } if (substr($ref, 0, 2) === "\x7e\x2f") { $realpath = Util\Common::realpath($ref); if ($realpath !== false) { $ref = $realpath; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\11\11\x3d\x3e\40" . Util\Common::stripBasepath($ref, $this->config->basepath) . PHP_EOL; } } } if (is_file($ref) === true) { if (substr($ref, -9) === "\123\x6e\x69\x66\x66\56\160\150\x70") { $this->rulesetDirs[] = dirname(dirname(dirname($ref))); return array($ref); } } else { $path = Util\Standards::getInstalledStandardPath($ref); if ($path !== null && Util\Common::isPharFile($path) === true && strpos($path, "\x72\165\x6c\145\x73\145\164\x2e\x78\x6d\x6c") === false) { if (file_exists($path . DIRECTORY_SEPARATOR . "\x72\x75\154\145\x73\x65\x74\56\x78\x6d\x6c") === true) { $path .= DIRECTORY_SEPARATOR . "\x72\165\x6c\145\163\145\x74\56\170\155\154"; } else { $path = null; } } if ($path !== null) { $ref = $path; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\x9\11\75\x3e\40" . Util\Common::stripBasepath($ref, $this->config->basepath) . PHP_EOL; } } else { if (is_dir($ref) === false) { $sepPos = strpos($ref, DIRECTORY_SEPARATOR); if ($sepPos !== false) { $stdName = substr($ref, 0, $sepPos); $path = substr($ref, $sepPos); } else { $parts = explode("\x2e", $ref); $stdName = $parts[0]; if (count($parts) === 1) { $path = ''; } else { if (count($parts) === 2) { $path = DIRECTORY_SEPARATOR . "\123\156\151\146\146\x73" . DIRECTORY_SEPARATOR . $parts[1]; } else { $path = DIRECTORY_SEPARATOR . "\123\x6e\x69\146\146\163" . DIRECTORY_SEPARATOR . $parts[1] . DIRECTORY_SEPARATOR . $parts[2] . "\x53\156\151\x66\x66\56\x70\150\160"; } } } $newRef = false; $stdPath = Util\Standards::getInstalledStandardPath($stdName); if ($stdPath !== null && $path !== '') { if (Util\Common::isPharFile($stdPath) === true && strpos($stdPath, "\x72\165\154\145\x73\x65\164\x2e\170\x6d\x6c") === false) { $newRef = Util\Common::realpath($stdPath . $path); } else { $newRef = Util\Common::realpath(dirname($stdPath) . $path); } } if ($newRef === false) { foreach ($this->rulesetDirs as $dir) { if (strtolower(basename($dir)) !== strtolower($stdName)) { continue; } $newRef = Util\Common::realpath($dir . $path); if ($newRef !== false) { $ref = $newRef; } } } else { $ref = $newRef; } if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\x9\11\x3d\x3e\x20" . Util\Common::stripBasepath($ref, $this->config->basepath) . PHP_EOL; } } } } if (is_dir($ref) === true) { if (is_file($ref . DIRECTORY_SEPARATOR . "\162\165\154\145\x73\145\164\56\x78\x6d\x6c") === true) { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\11\x9\52\40\162\x75\x6c\x65\40\151\x73\40\162\x65\146\x65\162\x65\156\x63\151\156\x67\40\x61\40\x73\x74\141\x6e\x64\141\x72\x64\40\165\163\151\x6e\147\40\x64\x69\x72\x65\143\x74\x6f\162\x79\x20\156\141\155\145\73\x20\160\162\x6f\x63\x65\163\x73\x69\x6e\147\x20\x2a" . PHP_EOL; } return $this->processRuleset($ref . DIRECTORY_SEPARATOR . "\162\165\154\x65\x73\x65\164\x2e\170\155\x6c", $depth + 2); } else { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\11\11\52\40\162\165\154\145\40\151\163\x20\x72\x65\146\x65\x72\x65\x6e\143\151\156\x67\40\141\x20\x64\151\x72\x65\143\164\157\x72\x79\40\x6f\x66\40\163\x6e\x69\146\146\163\x20\x2a" . PHP_EOL; echo str_repeat("\11", $depth); echo "\11\11\x41\x64\144\151\x6e\147\40\x73\x6e\x69\146\x66\x20\146\x69\x6c\145\x73\40\146\x72\157\155\x20\144\x69\162\145\x63\x74\157\x72\x79" . PHP_EOL; } return $this->expandSniffDirectory($ref, $depth + 1); } } else { if (is_file($ref) === false) { $error = "\x52\145\146\145\x72\x65\156\x63\145\144\x20\x73\x6e\151\x66\x66\40\42{$ref}\x22\x20\144\x6f\x65\163\x20\x6e\157\164\x20\x65\170\151\163\164"; throw new RuntimeException($error); } if (substr($ref, -9) === "\x53\x6e\151\x66\x66\56\x70\150\x70") { return array($ref); } else { if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\11\11\52\x20\162\x75\x6c\145\40\x69\x73\x20\162\x65\x66\145\162\145\x6e\x63\151\156\147\x20\x61\x20\x73\x74\x61\x6e\x64\141\x72\x64\x20\x75\163\151\156\147\40\162\x75\154\145\x73\145\x74\x20\x70\141\164\x68\x3b\40\160\162\157\x63\x65\x73\x73\151\x6e\x67\x20\x2a" . PHP_EOL; } return $this->processRuleset($ref, $depth + 2); } } } private function processRule($rule, $newSniffs, $depth = 0) { $ref = (string) $rule["\162\x65\146"]; $todo = array($ref); $parts = explode("\56", $ref); $partsCount = count($parts); if ($partsCount <= 2 || $partsCount > count(array_filter($parts)) || in_array($ref, $newSniffs) === true) { foreach ($newSniffs as $sniffFile) { $parts = explode(DIRECTORY_SEPARATOR, $sniffFile); if (count($parts) === 1 && DIRECTORY_SEPARATOR === "\134") { $parts = explode("\57", $sniffFile); } $sniffName = array_pop($parts); $sniffCategory = array_pop($parts); array_pop($parts); $sniffStandard = array_pop($parts); $todo[] = $sniffStandard . "\x2e" . $sniffCategory . "\x2e" . substr($sniffName, 0, -9); } } foreach ($todo as $code) { if (isset($rule->severity) === true && $this->shouldProcessElement($rule->severity) === true) { if (isset($this->ruleset[$code]) === false) { $this->ruleset[$code] = array(); } $this->ruleset[$code]["\x73\x65\x76\x65\162\x69\164\x79"] = (int) $rule->severity; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\11\11\75\76\40\x73\x65\x76\x65\x72\151\164\x79\x20\x73\x65\164\x20\x74\157\40" . (int) $rule->severity; if ($code !== $ref) { echo "\x20\146\157\x72\40{$code}"; } echo PHP_EOL; } } if (isset($rule->type) === true && $this->shouldProcessElement($rule->type) === true) { if (isset($this->ruleset[$code]) === false) { $this->ruleset[$code] = array(); } $type = strtolower((string) $rule->type); if ($type !== "\x65\162\162\x6f\162" && $type !== "\x77\141\162\156\151\156\147") { throw new RuntimeException("\x4d\x65\x73\x73\x61\x67\145\40\x74\x79\x70\x65\x20\x22{$type}\x22\x20\151\163\x20\x69\156\x76\141\154\151\x64\x3b\40\x6d\x75\x73\x74\x20\x62\x65\x20\x22\x65\162\162\x6f\x72\42\x20\157\x72\40\42\x77\x61\162\156\151\156\147\x22"); } $this->ruleset[$code]["\164\x79\160\x65"] = $type; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\x9\11\x3d\x3e\40\155\145\163\163\141\147\145\40\x74\171\x70\145\x20\x73\145\164\40\x74\x6f\x20" . (string) $rule->type; if ($code !== $ref) { echo "\x20\x66\x6f\x72\40{$code}"; } echo PHP_EOL; } } if (isset($rule->message) === true && $this->shouldProcessElement($rule->message) === true) { if (isset($this->ruleset[$code]) === false) { $this->ruleset[$code] = array(); } $this->ruleset[$code]["\155\145\163\x73\x61\x67\x65"] = (string) $rule->message; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\x9\11\75\76\x20\155\x65\x73\163\141\x67\x65\40\163\145\x74\x20\x74\x6f\40" . (string) $rule->message; if ($code !== $ref) { echo "\x20\146\x6f\x72\x20{$code}"; } echo PHP_EOL; } } if (isset($rule->properties) === true && $this->shouldProcessElement($rule->properties) === true) { $propertyScope = "\x73\x74\141\x6e\144\x61\162\144"; if ($code === $ref || substr($ref, -9) === "\x53\156\x69\146\x66\x2e\x70\150\160") { $propertyScope = "\x73\x6e\151\x66\146"; } foreach ($rule->properties->property as $prop) { if ($this->shouldProcessElement($prop) === false) { continue; } if (isset($this->ruleset[$code]) === false) { $this->ruleset[$code] = array("\160\x72\157\x70\145\162\x74\151\x65\x73" => array()); } else { if (isset($this->ruleset[$code]["\160\x72\x6f\x70\145\162\x74\x69\x65\163"]) === false) { $this->ruleset[$code]["\x70\162\x6f\160\145\162\x74\151\145\x73"] = array(); } } $name = (string) $prop["\x6e\x61\155\x65"]; if (isset($prop["\x74\x79\160\x65"]) === true && (string) $prop["\164\171\160\145"] === "\x61\x72\162\x61\x79") { $values = array(); if (isset($prop["\x65\x78\x74\x65\x6e\144"]) === true && (string) $prop["\145\x78\164\x65\156\144"] === "\164\x72\165\x65" && isset($this->ruleset[$code]["\x70\x72\x6f\x70\x65\162\164\151\145\x73"][$name]["\x76\x61\x6c\x75\145"]) === true) { $values = $this->ruleset[$code]["\x70\x72\157\x70\145\x72\x74\151\145\163"][$name]["\166\141\154\165\145"]; } if (isset($prop->element) === true) { $printValue = ''; foreach ($prop->element as $element) { if ($this->shouldProcessElement($element) === false) { continue; } $value = (string) $element["\x76\141\x6c\165\145"]; if (isset($element["\x6b\x65\x79"]) === true) { $key = (string) $element["\x6b\145\x79"]; $values[$key] = $value; $printValue .= $key . "\x3d\x3e" . $value . "\x2c"; } else { $values[] = $value; $printValue .= $value . "\54"; } } $printValue = rtrim($printValue, "\x2c"); } else { $value = (string) $prop["\x76\141\154\x75\x65"]; $printValue = $value; foreach (explode("\x2c", $value) as $val) { list($k, $v) = explode("\75\76", $val . "\x3d\76"); if ($v !== '') { $values[trim($k)] = trim($v); } else { $values[] = trim($k); } } } $this->ruleset[$code]["\160\x72\157\x70\x65\x72\164\151\145\163"][$name] = array("\x76\x61\154\x75\145" => $values, "\x73\143\x6f\160\x65" => $propertyScope); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\x9\11\75\x3e\x20\x61\162\162\141\171\40\x70\x72\x6f\160\x65\x72\x74\x79\x20\x22{$name}\x22\x20\x73\145\x74\40\164\x6f\40\42{$printValue}\x22"; if ($code !== $ref) { echo "\40\146\x6f\x72\40{$code}"; } echo PHP_EOL; } } else { $this->ruleset[$code]["\160\x72\x6f\x70\145\x72\164\151\x65\x73"][$name] = array("\x76\141\x6c\165\x65" => (string) $prop["\166\x61\x6c\165\x65"], "\163\x63\x6f\x70\x65" => $propertyScope); if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\11\x9\75\x3e\40\x70\x72\157\160\x65\x72\x74\x79\40\x22{$name}\42\40\163\145\164\x20\x74\x6f\x20\42" . (string) $prop["\166\141\154\x75\145"] . "\x22"; if ($code !== $ref) { echo "\x20\x66\x6f\x72\40{$code}"; } echo PHP_EOL; } } } } foreach ($rule->{"\145\x78\143\154\165\144\x65\x2d\x70\x61\164\x74\x65\162\156"} as $pattern) { if ($this->shouldProcessElement($pattern) === false) { continue; } if (isset($this->ignorePatterns[$code]) === false) { $this->ignorePatterns[$code] = array(); } if (isset($pattern["\x74\x79\x70\145"]) === false) { $pattern["\164\x79\160\145"] = "\141\x62\163\157\154\165\x74\145"; } $this->ignorePatterns[$code][(string) $pattern] = (string) $pattern["\164\171\x70\145"]; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\x9", $depth); echo "\x9\11\x3d\x3e\x20\141\x64\x64\145\x64\x20\x72\x75\x6c\145\x2d\x73\x70\x65\x63\151\146\x69\x63\x20" . (string) $pattern["\x74\171\160\x65"] . "\x20\x69\147\156\157\x72\x65\40\160\141\164\164\145\162\156"; if ($code !== $ref) { echo "\x20\146\x6f\162\x20{$code}"; } echo "\72\40" . (string) $pattern . PHP_EOL; } } foreach ($rule->{"\x69\x6e\143\154\x75\144\145\x2d\160\x61\x74\164\x65\x72\156"} as $pattern) { if ($this->shouldProcessElement($pattern) === false) { continue; } if (isset($this->includePatterns[$code]) === false) { $this->includePatterns[$code] = array(); } if (isset($pattern["\164\x79\x70\145"]) === false) { $pattern["\x74\171\160\x65"] = "\141\142\x73\x6f\x6c\x75\164\x65"; } $this->includePatterns[$code][(string) $pattern] = (string) $pattern["\x74\x79\x70\145"]; if (PHP_CODESNIFFER_VERBOSITY > 1) { echo str_repeat("\11", $depth); echo "\x9\x9\75\76\x20\x61\144\144\145\x64\x20\x72\x75\x6c\x65\x2d\x73\160\145\143\151\x66\151\x63\40" . (string) $pattern["\x74\171\160\x65"] . "\x20\x69\x6e\143\154\x75\144\145\x20\160\x61\164\x74\145\162\156"; if ($code !== $ref) { echo "\x20\146\157\162\x20{$code}"; } echo "\x3a\x20" . (string) $pattern . PHP_EOL; } } } } private function shouldProcessElement($element) { if (isset($element["\160\150\x70\143\142\x66\55\x6f\x6e\x6c\x79"]) === false && isset($element["\x70\x68\160\143\x73\55\157\156\154\x79"]) === false) { return true; } if (PHP_CODESNIFFER_CBF === true && isset($element["\x70\x68\160\143\142\146\55\157\x6e\154\171"]) === true && (string) $element["\x70\150\x70\143\x62\146\x2d\x6f\x6e\154\171"] === "\164\162\165\145") { return true; } if (PHP_CODESNIFFER_CBF === false && isset($element["\x70\150\x70\x63\163\55\157\x6e\x6c\x79"]) === true && (string) $element["\x70\150\160\143\163\55\157\x6e\x6c\x79"] === "\164\162\x75\145") { return true; } return false; } public function registerSniffs($files, $restrictions, $exclusions) { $listeners = array(); foreach ($files as $file) { $sniffPos = strrpos($file, DIRECTORY_SEPARATOR . "\123\156\x69\x66\x66\163" . DIRECTORY_SEPARATOR); if ($sniffPos === false) { continue; } $slashPos = strrpos(substr($file, 0, $sniffPos), DIRECTORY_SEPARATOR); if ($slashPos === false) { continue; } $className = Autoload::loadFile($file); $compareName = Util\Common::cleanSniffClass($className); if (empty($restrictions) === false && isset($restrictions[$compareName]) === false) { continue; } if (empty($exclusions) === false && isset($exclusions[$compareName]) === true) { continue; } $reflection = new \ReflectionClass($className); if ($reflection->isAbstract() === true) { continue; } $listeners[$className] = $className; if (PHP_CODESNIFFER_VERBOSITY > 2) { echo "\122\145\x67\x69\x73\164\x65\162\x65\144\x20{$className}" . PHP_EOL; } } $this->sniffs = $listeners; } public function populateTokenListeners() { $this->tokenListeners = array(); foreach ($this->sniffs as $sniffClass => $sniffObject) { $this->sniffs[$sniffClass] = null; $this->sniffs[$sniffClass] = new $sniffClass(); $sniffCode = Util\Common::getSniffCode($sniffClass); $this->sniffCodes[$sniffCode] = $sniffClass; if (isset($this->ruleset[$sniffCode]["\x70\x72\157\160\145\x72\x74\x69\145\163"]) === true) { foreach ($this->ruleset[$sniffCode]["\160\162\x6f\160\x65\162\x74\151\x65\x73"] as $name => $settings) { $this->setSniffProperty($sniffClass, $name, $settings); } } $tokenizers = array(); $vars = get_class_vars($sniffClass); if (isset($vars["\163\x75\160\160\x6f\x72\164\145\144\x54\157\153\x65\156\x69\x7a\x65\162\163"]) === true) { foreach ($vars["\163\x75\x70\x70\157\162\x74\145\x64\x54\157\x6b\145\156\151\x7a\145\162\x73"] as $tokenizer) { $tokenizers[$tokenizer] = $tokenizer; } } else { $tokenizers = array("\120\x48\x50" => "\120\110\x50"); } $tokens = $this->sniffs[$sniffClass]->register(); if (is_array($tokens) === false) { $msg = "\123\156\151\146\x66\x20{$sniffClass}\x20\x72\x65\147\151\163\x74\145\x72\50\51\40\x6d\145\164\150\x6f\144\40\155\165\x73\164\40\x72\x65\164\x75\x72\156\40\141\x6e\40\x61\x72\x72\141\171"; throw new RuntimeException($msg); } $ignorePatterns = array(); $patterns = $this->getIgnorePatterns($sniffCode); foreach ($patterns as $pattern => $type) { $replacements = array("\x5c\x2c" => "\54", "\x2a" => "\x2e\52"); $ignorePatterns[] = strtr($pattern, $replacements); } $includePatterns = array(); $patterns = $this->getIncludePatterns($sniffCode); foreach ($patterns as $pattern => $type) { $replacements = array("\134\54" => "\x2c", "\x2a" => "\56\x2a"); $includePatterns[] = strtr($pattern, $replacements); } foreach ($tokens as $token) { if (isset($this->tokenListeners[$token]) === false) { $this->tokenListeners[$token] = array(); } if (isset($this->tokenListeners[$token][$sniffClass]) === false) { $this->tokenListeners[$token][$sniffClass] = array("\143\154\141\x73\163" => $sniffClass, "\x73\157\165\x72\x63\145" => $sniffCode, "\164\x6f\x6b\145\156\151\x7a\145\x72\163" => $tokenizers, "\151\147\156\157\x72\x65" => $ignorePatterns, "\x69\x6e\143\x6c\x75\144\x65" => $includePatterns); } } } } public function setSniffProperty($sniffClass, $name, $settings) { if (isset($this->sniffs[$sniffClass]) === false) { return; } $name = trim($name); $propertyName = $name; if (substr($propertyName, -2) === "\x5b\135") { $propertyName = substr($propertyName, 0, -2); } if (is_array($settings) === false || isset($settings["\163\143\x6f\x70\x65"], $settings["\x76\141\154\165\145"]) === false) { $settings = array("\x76\x61\x6c\x75\x65" => $settings, "\163\x63\x6f\x70\145" => "\163\164\x61\156\144\x61\162\144"); trigger_error(__FUNCTION__ . "\x3a\40\x74\150\x65\40\146\x6f\162\x6d\x61\164\x20\157\x66\x20\x74\150\x65\x20\x24\163\145\164\164\151\156\147\163\40\160\141\162\141\155\145\164\145\162\x20\150\141\x73\x20\x63\x68\141\156\147\x65\x64\x20\x66\x72\157\x6d\x20\50\x6d\x69\170\145\144\x29\x20\44\x76\x61\x6c\x75\x65\x20\164\157\40\141\162\162\x61\171\50\47\163\x63\x6f\x70\145\47\40\x3d\x3e\40\47\163\x6e\x69\146\x66\x7c\x73\x74\x61\x6e\x64\x61\x72\x64\47\54\40\x27\x76\x61\x6c\165\x65\x27\x20\x3d\76\x20\x24\166\141\154\165\x65\51\x2e\40\x50\154\x65\x61\x73\145\x20\x75\160\144\x61\164\145\x20\171\x6f\165\162\x20\151\156\x74\x65\x67\162\141\164\x69\157\156\x20\143\x6f\144\145\56\40\x53\x65\x65\40\120\122\40\43\x33\66\62\x39\40\146\157\162\x20\155\157\162\145\x20\x69\x6e\146\157\162\x6d\x61\x74\151\157\x6e\x2e", E_USER_DEPRECATED); } $isSettable = false; $sniffObject = $this->sniffs[$sniffClass]; if (property_exists($sniffObject, $propertyName) === true || $sniffObject instanceof stdClass === true || method_exists($sniffObject, "\x5f\137\163\145\x74") === true) { $isSettable = true; } if ($isSettable === false) { if ($settings["\163\143\157\x70\145"] === "\163\x6e\151\146\146") { $notice = "\x52\165\x6c\x65\x73\x65\x74\40\151\x6e\166\141\154\151\144\56\x20\120\162\157\x70\145\x72\x74\x79\40\x22{$propertyName}\42\40\x64\x6f\x65\163\40\156\157\x74\40\x65\x78\x69\163\x74\x20\x6f\x6e\x20\x73\156\151\146\146\40"; $notice .= array_search($sniffClass, $this->sniffCodes, true); throw new RuntimeException($notice); } return; } $value = $settings["\166\x61\x6c\165\x65"]; if (is_string($value) === true) { $value = trim($value); } if ($value === '') { $value = null; } if ($value === "\x74\x72\165\x65") { $value = true; } else { if ($value === "\146\x61\x6c\163\145") { $value = false; } else { if (substr($name, -2) === "\133\x5d") { $name = $propertyName; $values = array(); if ($value !== null) { foreach (explode("\54", $value) as $val) { list($k, $v) = explode("\x3d\76", $val . "\75\x3e"); if ($v !== '') { $values[trim($k)] = trim($v); } else { $values[] = trim($k); } } } $value = $values; } } } $sniffObject->{$name} = $value; } public function getIgnorePatterns($listener = null) { if ($listener === null) { return $this->ignorePatterns; } if (isset($this->ignorePatterns[$listener]) === true) { return $this->ignorePatterns[$listener]; } return array(); } public function getIncludePatterns($listener = null) { if ($listener === null) { return $this->includePatterns; } if (isset($this->includePatterns[$listener]) === true) { return $this->includePatterns[$listener]; } return array(); } }
Function Calls
None |
Stats
MD5 | 866f87c5d55d456240c887b8063c6fec |
Eval Count | 0 |
Decode Time | 134 ms |