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

Breadcrumb

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

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

Common

Namespace

PHP_CodeSniffer\Util

Code

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