function Config::getExecutablePath
Get the path to an executable utility.
Parameters
string $name The name of the executable utility.:
Return value
string|null
See also
getConfigData()
9 calls to Config::getExecutablePath()
- ClosureLinterSniff::process in vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Generic/ Sniffs/ Debug/ ClosureLinterSniff.php - Processes the tokens that this sniff is interested in.
- CodeAnalyzerSniff::process in vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Zend/ Sniffs/ Debug/ CodeAnalyzerSniff.php - Processes the tokens that this sniff is interested in.
- CSSLintSniff::process in vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Generic/ Sniffs/ Debug/ CSSLintSniff.php - Processes the tokens that this sniff is interested in.
- ESLintSniff::process in vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Generic/ Sniffs/ Debug/ ESLintSniff.php - Processes the tokens that this sniff is interested in.
- JavaScriptLintSniff::process in vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Squiz/ Sniffs/ Debug/ JavaScriptLintSniff.php - Processes the tokens that this sniff is interested in.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Config.php, line 1468
Class
- Config
- Stores the configuration used to run PHPCS and PHPCBF.
Namespace
PHP_CodeSnifferCode
public static function getExecutablePath($name) {
$data = self::getConfigData($name . '_path');
if ($data !== null) {
return $data;
}
if ($name === "php") {
// For php, we know the executable path. There's no need to look it up.
return PHP_BINARY;
}
if (array_key_exists($name, self::$executablePaths) === true) {
return self::$executablePaths[$name];
}
if (stripos(PHP_OS, 'WIN') === 0) {
$cmd = 'where ' . escapeshellarg($name) . ' 2> nul';
}
else {
$cmd = 'which ' . escapeshellarg($name) . ' 2> /dev/null';
}
$result = exec($cmd, $output, $retVal);
if ($retVal !== 0) {
$result = null;
}
self::$executablePaths[$name] = $result;
return $result;
}