/** * Determine if a standard is installed. * * Coding standards are directories located in the * CodeSniffer/Standards directory. Valid coding standards * include a ruleset.xml file. * * @param string $standard The name of the coding standard. * * @return boolean * @see getInstalledStandards() */ public static function isInstalledStandard($standard) { $path = self::getInstalledStandardPath($standard); if ($path !== null && strpos($path, 'ruleset.xml') !== false) { return true; } else { // This could be a custom standard, installed outside our // standards directory. $standard = Common::realPath($standard); // Might be an actual ruleset file itUtil. // If it has an XML extension, let's at least try it. if (is_file($standard) === true && (substr(strtolower($standard), -4) === '.xml' || substr(strtolower($standard), -9) === '.xml.dist')) { return true; } // If it is a directory with a ruleset.xml file in it, // it is a standard. $ruleset = rtrim($standard, ' /\\') . DIRECTORY_SEPARATOR . 'ruleset.xml'; if (is_file($ruleset) === true) { return true; } } //end if return false; }