function Common::stripBasepath
Removes a base path from the front of a file path.
Parameters
string $path The path of the file.:
string $basepath The base path to remove. This should not end: with a directory separator.
Return value
string
1 call to Common::stripBasepath()
- Reporter::prepareFileReport in vendor/
squizlabs/ php_codesniffer/ src/ Reporter.php - Generate summary information to be used during report generation.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Util/ Common.php, line 144
Class
Namespace
PHP_CodeSniffer\UtilCode
public static function stripBasepath($path, $basepath) {
if (empty($basepath) === true) {
return $path;
}
$basepathLen = strlen($basepath);
if (substr($path, 0, $basepathLen) === $basepath) {
$path = substr($path, $basepathLen);
}
$path = ltrim($path, DIRECTORY_SEPARATOR);
if ($path === '') {
$path = '.';
}
return $path;
}