Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Common.php

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

Common

Namespace

PHP_CodeSniffer\Util

Code

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;
}
RSS feed
Powered by Drupal