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

Breadcrumb

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

function Compiler::getRelativeFilePath

1 call to Compiler::getRelativeFilePath()
Compiler::addFile in vendor/composer/composer/src/Composer/Compiler.php

File

vendor/composer/composer/src/Composer/Compiler.php, line 203

Class

Compiler
The Compiler class compiles composer into a phar

Namespace

Composer

Code

private function getRelativeFilePath(\SplFileInfo $file) : string {
    $realPath = $file->getRealPath();
    $pathPrefix = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR;
    $pos = strpos($realPath, $pathPrefix);
    $relativePath = $pos !== false ? substr_replace($realPath, '', $pos, strlen($pathPrefix)) : $realPath;
    return strtr($relativePath, '\\', '/');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal