function Standards::getInstalledStandardPath
Return the path of an installed coding standard.
Coding standards are directories located in the CodeSniffer/Standards directory. Valid coding standards include a ruleset.xml file.
Parameters
string $standard The name of the coding standard.:
Return value
string|null
3 calls to Standards::getInstalledStandardPath()
- Ruleset::expandRulesetReference in vendor/
squizlabs/ php_codesniffer/ src/ Ruleset.php - Expands a ruleset reference into a list of sniff files.
- Ruleset::__construct in vendor/
squizlabs/ php_codesniffer/ src/ Ruleset.php - Initialise the ruleset that the run will use.
- Standards::isInstalledStandard in vendor/
squizlabs/ php_codesniffer/ src/ Util/ Standards.php - Determine if a standard is installed.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Util/ Standards.php, line 280
Class
Namespace
PHP_CodeSniffer\UtilCode
public static function getInstalledStandardPath($standard) {
if (strpos($standard, '.') !== false) {
return null;
}
$installedPaths = self::getInstalledStandardPaths();
foreach ($installedPaths as $installedPath) {
$standardPath = $installedPath . DIRECTORY_SEPARATOR . $standard;
if (file_exists($standardPath) === false) {
if (basename($installedPath) !== $standard) {
continue;
}
$standardPath = $installedPath;
}
$path = Common::realpath($standardPath . DIRECTORY_SEPARATOR . 'ruleset.xml');
if ($path !== false && is_file($path) === true) {
return $path;
}
else {
if (Common::isPharFile($standardPath) === true) {
$path = Common::realpath($standardPath);
if ($path !== false) {
return $path;
}
}
}
}
//end foreach
return null;
}