function Common::cleanSniffClass
Removes project-specific information from a sniff class name.
Parameters
string $sniffClass The fully qualified sniff class name.:
Return value
string
1 call to Common::cleanSniffClass()
- Ruleset::registerSniffs in vendor/
squizlabs/ php_codesniffer/ src/ Ruleset.php - Loads and stores sniffs objects used for sniffing files.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Util/ Common.php, line 581
Class
Namespace
PHP_CodeSniffer\UtilCode
public static function cleanSniffClass($sniffClass) {
$newName = strtolower($sniffClass);
$sniffPos = strrpos($newName, '\\sniffs\\');
if ($sniffPos === false) {
// Nothing we can do as it isn't in a known format.
return $newName;
}
$end = strlen($newName) - $sniffPos + 1;
$start = strrpos($newName, '\\', $end * -1);
if ($start === false) {
// Nothing needs to be cleaned.
return $newName;
}
$newName = substr($newName, $start + 1);
return $newName;
}